depot osai
This commit is contained in:
@@ -53,6 +53,12 @@ export default class depot extends Vue {
|
||||
return this.getAvaiableTools[index - this.getAvaiableMultiTools.length];
|
||||
}
|
||||
|
||||
public getPayloadForNcAvailableShank(index: number): any{
|
||||
if (index < this.getNcAvailableShank.length){
|
||||
return this.getNcAvailableShank[index];
|
||||
}
|
||||
}
|
||||
|
||||
public onDrag({ isSource, payload, willAcceptDrop }) {
|
||||
this.draggingIn = true;
|
||||
this.draggingTool = payload;
|
||||
@@ -288,13 +294,28 @@ export default class depot extends Vue {
|
||||
alert("sadasdsa");
|
||||
}
|
||||
|
||||
public toolIsInError(tool) {
|
||||
public toolIsInWarning(tool){
|
||||
if (tool)
|
||||
return (this.$store.getters as ToolingGetters).toolIsInWarning(tool.id);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public ncShankgIsInWarning(shank){
|
||||
return (this.$store.getters as ToolingGetters).ncShankIsInWarning(shank.id);
|
||||
}
|
||||
|
||||
public toolIsInError(model) {
|
||||
if(model){
|
||||
if(this.typeNc == "Demo"){
|
||||
this.toolIsInWarning(model)
|
||||
}
|
||||
else{
|
||||
this.ncShankgIsInWarning(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public returnChild(elem) {
|
||||
if (!elem)
|
||||
return null;
|
||||
@@ -466,11 +487,11 @@ export default class depot extends Vue {
|
||||
if (this.draggingTool && this.draggingPosition == position.positionId) {
|
||||
if (this.ncToolAtPosition(position.positionId) || position.disabled || !this.checkMagPosType(position.type))
|
||||
return
|
||||
|
||||
this.draggingIn = false;
|
||||
this.draggingTool = null;
|
||||
var toolToAdd = event.payload;
|
||||
new DepotService().AddToolToDepotNc(this.depotId, position.positionId, { toolId: toolToAdd.id }).then(response => {
|
||||
var shankToAdd = event.payload;
|
||||
|
||||
new DepotService().AddToolToDepotNc(this.depotId, position.positionId, { shankId: shankToAdd.id }).then(response => {
|
||||
|
||||
});
|
||||
}
|
||||
@@ -487,7 +508,11 @@ export default class depot extends Vue {
|
||||
// new DepotService().AddToolToDepotNc(this.depotId, position.positionId, { toolId: toolToAdd.id }).then(response => {
|
||||
|
||||
// });
|
||||
public removeToolsToDepot(position, toolToAdd) {
|
||||
public removeToolsToDepot(position, model) {
|
||||
debugger
|
||||
if(model.shankId){
|
||||
model.id = model.shankId;
|
||||
}
|
||||
if (this.editable){
|
||||
if(this.typeNc == "Demo"){
|
||||
new DepotService().RemoveToolToDepot(this.depotId, position).then(response => {
|
||||
@@ -495,7 +520,7 @@ export default class depot extends Vue {
|
||||
});
|
||||
}
|
||||
else{
|
||||
new DepotService().RemoveToolToDepotNc(this.depotId, position).then(response => {
|
||||
new DepotService().RemoveToolToDepotNc(this.depotId, position, {shankId: model.id}).then(response => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
<i class="fa fa-2x fa-search"></i>
|
||||
</div>
|
||||
<div class="list-vertical scrollable">
|
||||
<Container @drag-start="onDrag" @drag-end="onDragEnd" :shoud-animate-drop="disableDropAnimation" :get-child-payload="getPayloadForAvaiableTools" group-name="tools">
|
||||
<Container @drag-start="onDrag" @drag-end="onDragEnd" :shoud-animate-drop="disableDropAnimation" :get-child-payload="getPayloadForNcAvailableShank" group-name="tools">
|
||||
<Draggable v-for="m in getNcAvailableShank" :key="m.id" >
|
||||
<div>
|
||||
<tool :code="'tooling_shank_abbreviation' | localize('S%d',m.id)" :title="m.id" img-source="../assets/icons/Tools/Shanks.png" @click="openInfoShank(m.id)"></tool>
|
||||
@@ -150,11 +150,11 @@
|
||||
<span class="empty" v-if="!ncToolAtPosition(pos.positionId) && !pos.disabled && checkMagPosType(pos.type) && draggingIn">{{'depot_avaiable_position' | localize("Posizione disponibile")}}</span>
|
||||
</Container>
|
||||
<card-tool-depot :class="{'stateProblemsTool': enableStateProblemTool && toolIsInError(returnNcChild(ncToolAtPosition(pos.positionId)))}" v-if="ncToolAtPosition(pos.positionId)"
|
||||
:code="returnNcChild(ncToolAtPosition(pos.positionId)).namedId"
|
||||
:title="returnNcChild(ncToolAtPosition(pos.positionId)).name"
|
||||
:code="returnNcChild(ncToolAtPosition(pos.positionId)).id || ncToolAtPosition(pos.positionId).id"
|
||||
:title="returnNcChild(ncToolAtPosition(pos.positionId)).id || ncToolAtPosition(pos.positionId).id"
|
||||
:imgSource="getInfoNcShankIcon()"
|
||||
:editable="editable"
|
||||
@click="removeToolsToDepot(pos.positionId, ...arguments)"
|
||||
@click="removeToolsToDepot(pos.positionId, ncToolAtPosition(pos.positionId))"
|
||||
@clickinfo="openInfoShank(ncToolAtPosition(pos.positionId).id)">
|
||||
</card-tool-depot>
|
||||
</detail-card>
|
||||
|
||||
@@ -42,9 +42,9 @@ export class DepotService extends baseRestService {
|
||||
return result;
|
||||
}
|
||||
|
||||
async AddToolToDepotNc(magazineId, positionId, toolId) {
|
||||
let result = await this.Put < any > (this.BASE_URL + "nc/magazine/" + magazineId + "/load/position/" + positionId, toolId);
|
||||
depotActions.setDepot(store, result);
|
||||
async AddToolToDepotNc(magazineId, positionId, shankId) {
|
||||
let result = await this.Put < any > (this.BASE_URL + "nc/magazine/" + magazineId + "/load/position/" + positionId, shankId);
|
||||
depotActions.setNcDepot(store, result);
|
||||
this.GetNcShankAvailable();
|
||||
return result;
|
||||
}
|
||||
@@ -56,8 +56,8 @@ export class DepotService extends baseRestService {
|
||||
return result;
|
||||
}
|
||||
|
||||
async RemoveToolToDepotNc(magazineId, positionId) {
|
||||
let result = await this.Put < any > (this.BASE_URL + "nc/magazine/" + magazineId + "/unload/position/" + positionId, {});
|
||||
async RemoveToolToDepotNc(magazineId, positionId, model) {
|
||||
let result = await this.Put < any > (this.BASE_URL + "nc/magazine/" + magazineId + "/unload/position/" + positionId, model);
|
||||
depotActions.removeNcShankFromDepot(store, {magazineId:magazineId, positionId:positionId}as server.DepotNcModel);
|
||||
this.GetNcShankAvailable();
|
||||
return result;
|
||||
|
||||
@@ -11,7 +11,8 @@ export interface DepotStoreModel {
|
||||
export interface DepotActions {
|
||||
updateDepot(context, model:server.DepotModel[]);
|
||||
updateNcDepot(context, model: server.DepotNcModel[]);
|
||||
setDepot(context, model:server.DepotModel);
|
||||
setDepot(context, model:server.DepotModel);
|
||||
setNcDepot(context, model: server.DepotNcModel);
|
||||
removeToolFromDepot(context, model:server.DepotModel);
|
||||
removeNcShankFromDepot(context, model: server.DepotNcModel);
|
||||
updateAvailableMultiTool(context, model:server.MultiTools[]);
|
||||
@@ -54,7 +55,16 @@ export interface DepotStoreModel {
|
||||
else{
|
||||
store.depot.push(model);
|
||||
}
|
||||
},
|
||||
},
|
||||
setNcDepot(store, model: server.DepotNcModel){
|
||||
let d = store.depotNc.find(d => model.positionId == d.positionId && model.magazineId == d.magazineId);
|
||||
if(d){
|
||||
store.depotNc.splice(store.depot.indexOf(d), 1, model);
|
||||
}
|
||||
else{
|
||||
store.depotNc.push(model);
|
||||
}
|
||||
},
|
||||
RemoveToolFromDepot(store, model:server.DepotModel) {
|
||||
let d = store.depot.find(d => model.positionId == d.positionId && model.magazineId == d.magazineId);
|
||||
if (d) {
|
||||
@@ -102,7 +112,10 @@ export interface DepotStoreModel {
|
||||
actions: {
|
||||
setDepot(context, model:server.DepotModel) {
|
||||
context.commit("setDepot", model);
|
||||
},
|
||||
},
|
||||
setNcDepot(context, model: server.DepotNcModel){
|
||||
context.commit("setNcDepot", model);
|
||||
},
|
||||
updateDepot(context, model:server.DepotModel[]) {
|
||||
context.commit("UpdateDepot", model);
|
||||
},
|
||||
|
||||
@@ -33,6 +33,7 @@ export interface ToolingStoreModel {
|
||||
|
||||
export interface ToolingGetters{
|
||||
toolIsInWarning : (id) => boolean;
|
||||
ncShankIsInWarning : (id) => boolean;
|
||||
positionCompatible : (id,posType) => boolean;
|
||||
}
|
||||
|
||||
@@ -157,6 +158,15 @@ export const toolingStore = {
|
||||
}
|
||||
|
||||
},
|
||||
ncShankIsInWarning : (state) => (id) : boolean =>{
|
||||
let ncShank = state.ncShanks.find(t => t.id === id);
|
||||
if(ncShank){
|
||||
return ncShank.disabled || ncShank.broken || ncShank.residualLife <= 0;
|
||||
}
|
||||
else{
|
||||
return null
|
||||
}
|
||||
},
|
||||
positionCompatible : (state) => (id,posType) : boolean =>{
|
||||
|
||||
if(!posType || posType==0)
|
||||
|
||||
Reference in New Issue
Block a user