feat: item.descriptor en summary coge el warehouse por defecto
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2023-02-03 14:31:50 +01:00
parent 508bce73bc
commit ba5616055b
6 changed files with 21 additions and 12 deletions

View File

@ -18,9 +18,6 @@
},
"expired": {
"type": "date"
},
"warehouseFk": {
"type": "number"
}
},
"scope": {

View File

@ -0,0 +1,4 @@
ALTER TABLE `vn`.`itemConfig` ADD warehouseFk smallint(6) unsigned NULL;
UPDATE `vn`.`itemConfig`
SET warehouseFk=60
WHERE id=0;

View File

@ -98,11 +98,9 @@ module.exports = Self => {
summary.tags = res[1];
[summary.botanical] = res[2];
const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions);
console.log(userConfig.warehouseFk);
const company = await models.Company.findOne({where: {code: 'VNL'}}, myOptions);
console.log(company.warehouseFk);
res = await models.Item.getVisibleAvailable(summary.item.id, 1, undefined, myOptions);
const itemConfig = await models.ItemConfig.findOne({where: {code: 'VNL'}}, myOptions);
res = await models.Item.getVisibleAvailable(summary.item.id, itemConfig.warehouseFk, undefined, myOptions);
summary.available = res.available;
summary.visible = res.visible;

View File

@ -25,6 +25,9 @@
},
"defaultTag": {
"type": "int"
},
"warehouseFk": {
"type": "int"
}
},
"relations": {

View File

@ -1,6 +1,6 @@
<vn-portal slot="menu">
<vn-item-descriptor
warehouse-fk="$ctrl.getWarehouseFk()"
warehouse-fk="$ctrl.warehouseFk"
item="$ctrl.item"
card-reload="$ctrl.reload()"></vn-item-descriptor>
<vn-left-menu source="card"></vn-left-menu>

View File

@ -3,14 +3,21 @@ import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard {
getWarehouseFk() {
if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary')
return this.$params.warehouseFk;
return this.vnConfig.warehouseFk;
if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary') {
this.warehouseFk = this.$params.warehouseFk;
return;
}
this.$http.get('ItemConfigs/findOne')
.then(res => {
this.warehouseFk = res.data.warehouseFk;
});
}
reload() {
this.$http.get(`Items/${this.$params.id}/getCard`)
.then(res => this.item = res.data);
this.getWarehouseFk();
}
}