Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4369-ticket.request.create_getItemTypeWorker
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-10-04 08:19:38 +02:00
commit 6e9909400b
31 changed files with 177 additions and 106 deletions

View File

@ -0,0 +1,4 @@
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
VALUES ('Sector','*','READ','ALLOW','ROLE','employee');
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
VALUES ('Sector','*','WRITE','ALLOW','ROLE','employee');

View File

@ -862,25 +862,25 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`)
('VT', 'Sales'); ('VT', 'Sales');
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`, INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`,
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`) `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`)
VALUES VALUES
(1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0, 15), (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0, 15,3),
(2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10), (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10,2),
(3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5), (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5,5),
(4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL), (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL), (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL), (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL), (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL), (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL), (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
(10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL), (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL), (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL), (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL), (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL,NULL),
(14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL), (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL), (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
(16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL), (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
(71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL); (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL);
-- Update the taxClass after insert of the items -- Update the taxClass after insert of the items
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2 UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2

View File

@ -391,7 +391,7 @@ export default {
intrastadCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Intrastat"]', intrastadCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Intrastat"]',
originCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Origin"]', originCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Origin"]',
buyerCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Buyer"]', buyerCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Buyer"]',
densityCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Density"]', weightByPieceCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Weight/Piece"]',
saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button' saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button'
}, },
itemFixedPrice: { itemFixedPrice: {

View File

@ -31,7 +31,7 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox); await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
await page.waitToClick(selectors.itemsIndex.originCheckbox); await page.waitToClick(selectors.itemsIndex.originCheckbox);
await page.waitToClick(selectors.itemsIndex.buyerCheckbox); await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
await page.waitToClick(selectors.itemsIndex.densityCheckbox); await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox);
await page.waitToClick(selectors.itemsIndex.saveFieldsButton); await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
@ -64,7 +64,7 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox); await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
await page.waitToClick(selectors.itemsIndex.originCheckbox); await page.waitToClick(selectors.itemsIndex.originCheckbox);
await page.waitToClick(selectors.itemsIndex.buyerCheckbox); await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
await page.waitToClick(selectors.itemsIndex.densityCheckbox); await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox);
await page.waitToClick(selectors.itemsIndex.saveFieldsButton); await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();

View File

@ -23,12 +23,15 @@ export default class InputTime extends Field {
let date = null; let date = null;
let value = this.input.value; let value = this.input.value;
if (this.field && !this.modelDate)
this.modelDate = this.field;
if (value) { if (value) {
let split = value.split(':').map(i => parseInt(i) || null); let split = value.split(':').map(i => parseInt(i) || null);
date = this.field instanceof Date date = this.modelDate
? this.field ? new Date(this.modelDate)
: new Date(this.field || null); : new Date();
date.setHours(split[0], split[1], 0, 0); date.setHours(split[0], split[1], 0, 0);
} }

View File

@ -52,7 +52,7 @@ module.exports = Self => {
switch (field) { switch (field) {
case 'size': case 'size':
case 'density': case 'weightByPiece':
case 'description': case 'description':
case 'packingOut': case 'packingOut':
modelName = 'Item'; modelName = 'Item';

View File

@ -157,7 +157,7 @@ module.exports = Self => {
i.image, i.image,
i.id AS itemFk, i.id AS itemFk,
i.size, i.size,
i.density, i.weightByPiece,
it.code, it.code,
i.typeFk, i.typeFk,
i.family, i.family,

View File

@ -68,8 +68,8 @@
<th field="origin"> <th field="origin">
<span translate>Origin</span> <span translate>Origin</span>
</th> </th>
<th field="density"> <th field="weightByPiece">
<span translate>Density</span> <span translate>Weight/Piece</span>
</th> </th>
<th field="isActive"> <th field="isActive">
<span translate>Active</span> <span translate>Active</span>
@ -183,7 +183,7 @@
{{::buy.intrastat}} {{::buy.intrastat}}
</td> </td>
<td>{{::buy.origin}}</td> <td>{{::buy.origin}}</td>
<td>{{::buy.density}}</td> <td>{{::buy.weightByPiece}}</td>
<td> <td>
<vn-check <vn-check
disabled="true" disabled="true"

View File

@ -80,7 +80,7 @@ export default class Controller extends Section {
{field: 'weight', displayName: this.$t('Weight')}, {field: 'weight', displayName: this.$t('Weight')},
{field: 'description', displayName: this.$t('Description')}, {field: 'description', displayName: this.$t('Description')},
{field: 'size', displayName: this.$t('Size')}, {field: 'size', displayName: this.$t('Size')},
{field: 'density', displayName: this.$t('Density')}, {field: 'weightByPiece', displayName: this.$t('weight/Piece')},
{field: 'packingOut', displayName: this.$t('PackingOut')}, {field: 'packingOut', displayName: this.$t('PackingOut')},
{field: 'landing', displayName: this.$t('Landing')} {field: 'landing', displayName: this.$t('Landing')}
]; ];
@ -103,7 +103,7 @@ export default class Controller extends Section {
switch (param) { switch (param) {
case 'id': case 'id':
case 'size': case 'size':
case 'density': case 'weightByPiece':
case 'isActive': case 'isActive':
case 'family': case 'family':
case 'minPrice': case 'minPrice':

View File

@ -42,7 +42,6 @@ module.exports = Self => {
origin.itemTag = undefined; origin.itemTag = undefined;
origin.description = undefined; origin.description = undefined;
origin.image = undefined;
origin.comment = undefined; origin.comment = undefined;
origin.size = undefined; origin.size = undefined;

View File

@ -160,7 +160,7 @@ module.exports = Self => {
i.subName, i.subName,
i.isActive, i.isActive,
i.stems, i.stems,
i.density, i.weightByPiece,
i.stemMultiplier, i.stemMultiplier,
i.typeFk, i.typeFk,
i.isFloramondo, i.isFloramondo,

View File

@ -21,7 +21,7 @@ describe('item clone()', () => {
const result = await models.Item.clone(itemFk, options); const result = await models.Item.clone(itemFk, options);
expect(result.id).toEqual(nextItemId); expect(result.id).toEqual(nextItemId);
expect(result.image).toBeUndefined(); expect(result.image).toBeDefined();
expect(result.itemTag).toBeUndefined(); expect(result.itemTag).toBeUndefined();
expect(result.comment).toBeUndefined(); expect(result.comment).toBeUndefined();
expect(result.description).toBeUndefined(); expect(result.description).toBeUndefined();

View File

@ -53,9 +53,9 @@
"type": "number", "type": "number",
"description": "Relevancy" "description": "Relevancy"
}, },
"density": { "weightByPiece": {
"type": "number", "type": "number",
"description": "Density" "description": "WeightByPiece"
}, },
"stemMultiplier": { "stemMultiplier": {
"type": "number", "type": "number",
@ -143,6 +143,9 @@
}, },
"packingShelve": { "packingShelve": {
"type": "number" "type": "number"
},
"weightByPiece": {
"type": "number"
} }
}, },
"relations": { "relations": {

View File

@ -124,9 +124,8 @@
<vn-input-number <vn-input-number
vn-one vn-one
min="0" min="0"
step="0.01" label="Weight/Piece"
label="Density" ng-model="$ctrl.item.weightByPiece"
ng-model="$ctrl.item.density"
rule> rule>
</vn-input-number> </vn-input-number>
<vn-autocomplete <vn-autocomplete

View File

@ -45,8 +45,8 @@
<th field="buyerFk"> <th field="buyerFk">
<span translate>Buyer</span> <span translate>Buyer</span>
</th> </th>
<th field="density"> <th field="weightByPiece">
<span translate>Density</span> <span translate>Weight/Piece</span>
</th> </th>
<th field="stemMultiplier"> <th field="stemMultiplier">
<span translate>Multiplier</span> <span translate>Multiplier</span>
@ -117,7 +117,7 @@
{{::item.userName}} {{::item.userName}}
</span> </span>
</td> </td>
<td>{{::item.density}}</td> <td>{{::item.weightByPiece}}</td>
<td>{{::item.stemMultiplier}}</td> <td>{{::item.stemMultiplier}}</td>
<td> <td>
<vn-check <vn-check

View File

@ -87,7 +87,7 @@ class Controller extends Section {
case 'size': case 'size':
case 'subname': case 'subname':
case 'isActive': case 'isActive':
case 'density': case 'weightByPiece':
case 'stemMultiplier': case 'stemMultiplier':
case 'stems': case 'stems':
return {[`i.${param}`]: value}; return {[`i.${param}`]: value};

View File

@ -40,7 +40,7 @@ Create: Crear
Client card: Ficha del cliente Client card: Ficha del cliente
Shipped: F. envío Shipped: F. envío
stems: Tallos stems: Tallos
Density: Densidad Weight/Piece: Peso/tallo
Search items by id, name or barcode: Buscar articulos por identificador, nombre o codigo de barras Search items by id, name or barcode: Buscar articulos por identificador, nombre o codigo de barras
SalesPerson: Comercial SalesPerson: Comercial
Concept: Concepto Concept: Concepto

View File

@ -91,8 +91,8 @@
<vn-label-value label="Relevancy" <vn-label-value label="Relevancy"
value="{{$ctrl.summary.item.relevancy}}"> value="{{$ctrl.summary.item.relevancy}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Density" <vn-label-value label="Weight/Piece"
value="{{$ctrl.summary.item.density}}"> value="{{$ctrl.summary.item.weightByPiece}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Expense" <vn-label-value label="Expense"
value="{{$ctrl.summary.item.expense.name}}"> value="{{$ctrl.summary.item.expense.name}}">

View File

@ -210,6 +210,9 @@
</slot-table> </slot-table>
</smart-table> </smart-table>
</vn-card> </vn-card>
<vn-ticket-descriptor-popover
vn-id="ticketDescriptor">
</vn-ticket-descriptor-popover>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor"> vn-id="workerDescriptor">
</vn-worker-descriptor-popover> </vn-worker-descriptor-popover>

View File

@ -7,5 +7,8 @@
}, },
"ShelvingLog": { "ShelvingLog": {
"dataSource": "vn" "dataSource": "vn"
},
"Sector": {
"dataSource": "vn"
} }
} }

View File

@ -0,0 +1,72 @@
{
"name": "Sector",
"base": "VnModel",
"options": {
"mysql": {
"table": "sector"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"description": {
"type": "string",
"required": true
},
"warehouseFk": {
"type": "number",
"required": true
},
"isPreviousPreparedByPacking": {
"type": "boolean",
"required": true
},
"code": {
"type": "string",
"required": false
},
"isPreviousPrepared": {
"type": "boolean",
"required": true
},
"isPackagingArea": {
"type": "boolean",
"required": true
},
"reportFk": {
"type": "number",
"required": false
},
"sonFk": {
"type": "number",
"required": false
},
"isMain": {
"type": "boolean",
"required": true
},
"itemPackingTypeFk": {
"type": "string",
"required": false
},
"workerFk": {
"type": "number",
"required": false
},
"printerFk": {
"type": "number",
"required": false
},
"isHideForPickers": {
"type": "boolean",
"required": true
},
"isReserve": {
"type": "boolean",
"required": true
}
}
}

View File

@ -130,8 +130,8 @@ module.exports = Self => {
SUM(b.stickers) AS stickers, SUM(b.stickers) AS stickers,
s.id AS cargoSupplierFk, s.id AS cargoSupplierFk,
s.nickname AS cargoSupplierNickname, s.nickname AS cargoSupplierNickname,
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg, CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
FROM travel t FROM travel t
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
LEFT JOIN entry e ON e.travelFk = t.id LEFT JOIN entry e ON e.travelFk = t.id
@ -143,7 +143,8 @@ module.exports = Self => {
JOIN warehouse wo ON wo.id = t.warehouseOutFk JOIN warehouse wo ON wo.id = t.warehouseOutFk
JOIN country c ON c.id = wo.countryFk JOIN country c ON c.id = wo.countryFk
LEFT JOIN continent cnt ON cnt.id = c.continentFk LEFT JOIN continent cnt ON cnt.id = c.continentFk
JOIN agencyMode am ON am.id = t.agencyModeFk` JOIN agencyMode am ON am.id = t.agencyModeFk
JOIN vn.volumeConfig vc`
); );
stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeWhere(filter.where));
@ -165,15 +166,16 @@ module.exports = Self => {
SUM(b.stickers) AS stickers, SUM(b.stickers) AS stickers,
e.evaNotes, e.evaNotes,
e.notes, e.notes,
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedkg, CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg,
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) AS DECIMAL(10,0)) as volumeKg
FROM tmp.travel tr FROM tmp.travel tr
JOIN entry e ON e.travelFk = tr.id JOIN entry e ON e.travelFk = tr.id
JOIN buy b ON b.entryFk = e.id JOIN buy b ON b.entryFk = e.id
JOIN packaging pkg ON pkg.id = b.packageFk JOIN packaging pkg ON pkg.id = b.packageFk
JOIN item i ON i.id = b.itemFk JOIN item i ON i.id = b.itemFk
JOIN itemType it ON it.id = i.typeFk JOIN itemType it ON it.id = i.typeFk
JOIN supplier s ON s.id = e.supplierFk` JOIN supplier s ON s.id = e.supplierFk
JOIN vn.volumeConfig vc`
); );
stmt.merge(conn.makeGroupBy('e.id')); stmt.merge(conn.makeGroupBy('e.id'));

View File

@ -20,9 +20,6 @@
"EducationLevel": { "EducationLevel": {
"dataSource": "vn" "dataSource": "vn"
}, },
"Sector": {
"dataSource": "vn"
},
"WorkCenter": { "WorkCenter": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -1,20 +0,0 @@
{
"name": "Sector",
"base": "VnModel",
"options": {
"mysql": {
"table": "sector"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"description": {
"type": "string",
"required": true
}
}
}

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-back", "name": "salix-back",
"version": "8.6.0", "version": "8.8.0",
"author": "Verdnatura Levante SL", "author": "Verdnatura Levante SL",
"description": "Salix backend", "description": "Salix backend",
"license": "GPL-3.0", "license": "GPL-3.0",
@ -37,7 +37,7 @@
"node-ssh": "^11.0.0", "node-ssh": "^11.0.0",
"object-diff": "0.0.4", "object-diff": "0.0.4",
"object.pick": "^1.3.0", "object.pick": "^1.3.0",
"puppeteer": "^7.1.0", "puppeteer": "^18.0.5",
"read-chunk": "^3.2.0", "read-chunk": "^3.2.0",
"require-yaml": "0.0.1", "require-yaml": "0.0.1",
"sharp": "^0.27.1", "sharp": "^0.27.1",

View File

@ -29,7 +29,7 @@ module.exports = {
for (let attachment of options.attachments) { for (let attachment of options.attachments) {
const fileName = attachment.filename; const fileName = attachment.filename;
const filePath = attachment.path; const filePath = attachment.path;
if (fileName.includes('.png')) return; if (fileName.includes('.png')) continue;
if (fileName || filePath) if (fileName || filePath)
attachments.push(filePath ? filePath : fileName); attachments.push(filePath ? filePath : fileName);

View File

@ -11,15 +11,17 @@ module.exports = async function(request, response, next) {
if (reqArgs.to) toDate = reqArgs.to; if (reqArgs.to) toDate = reqArgs.to;
const todayMinDate = new Date(); const todayMinDate = new Date();
minDate.setHours(0, 0, 0, 0); todayMinDate.setHours(0, 0, 0, 0);
const todayMaxDate = new Date(); const todayMaxDate = new Date();
maxDate.setHours(23, 59, 59, 59); todayMinDate.setHours(23, 59, 59, 59);
// Prevent closure for current day // Prevent closure for current day
if (toDate >= todayMinDate && toDate <= todayMaxDate) if (toDate >= todayMinDate && toDate <= todayMaxDate)
throw new Error('You cannot close tickets for today'); throw new Error('You cannot close tickets for today');
console.log(`Making closure up to ${toDate}...`);
const tickets = await db.rawSql(` const tickets = await db.rawSql(`
SELECT SELECT
t.id, t.id,

View File

@ -7,11 +7,13 @@ const storage = require('vn-print/core/storage');
module.exports = { module.exports = {
async start(tickets, reqArgs) { async start(tickets, reqArgs) {
console.log(tickets);
if (tickets.length == 0) return; if (tickets.length == 0) return;
const failedtickets = []; const failedtickets = [];
for (const ticket of tickets) { for (const ticket of tickets) {
try { try {
console.log(`Closing ticket id ${ticket.id}...`);
await db.rawSql(`CALL vn.ticket_closeByTicket(?)`, [ticket.id]); await db.rawSql(`CALL vn.ticket_closeByTicket(?)`, [ticket.id]);
const invoiceOut = await db.findOne(` const invoiceOut = await db.findOne(`

View File

@ -4,14 +4,15 @@ SELECT
e.ref, e.ref,
s.name AS supplierName, s.name AS supplierName,
SUM(b.stickers) AS stickers, SUM(b.stickers) AS stickers,
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg, CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
FROM travel t FROM travel t
JOIN entry e ON e.travelFk = t.id JOIN entry e ON e.travelFk = t.id
JOIN buy b ON b.entryFk = e.id JOIN buy b ON b.entryFk = e.id
JOIN packaging pkg ON pkg.id = b.packageFk JOIN packaging pkg ON pkg.id = b.packageFk
JOIN item i ON i.id = b.itemFk JOIN item i ON i.id = b.itemFk
JOIN itemType it ON it.id = i.typeFk JOIN itemType it ON it.id = i.typeFk
JOIN supplier s ON s.id = e.supplierFk JOIN supplier s ON s.id = e.supplierFk
JOIN vn.volumeConfig vc
WHERE t.id IN(?) WHERE t.id IN(?)
GROUP BY e.id GROUP BY e.id

View File

@ -6,9 +6,10 @@ SELECT
t.kg, t.kg,
am.id AS agencyModeFk, am.id AS agencyModeFk,
SUM(b.stickers) AS stickers, SUM(b.stickers) AS stickers,
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg, CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
FROM travel t FROM travel t
JOIN volumeConfig vc
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
LEFT JOIN entry e ON e.travelFk = t.id LEFT JOIN entry e ON e.travelFk = t.id
LEFT JOIN buy b ON b.entryFk = e.id LEFT JOIN buy b ON b.entryFk = e.id