fix: entry ref
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2022-11-30 15:24:33 +01:00
parent 67cf4ebbea
commit 8df7b91127
13 changed files with 77 additions and 70 deletions

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`entry` DROP COLUMN `ref`;

View File

@ -2199,7 +2199,8 @@ INSERT INTO `ACL` VALUES
(394,'Url','*','WRITE','ALLOW','ROLE','it'), (394,'Url','*','WRITE','ALLOW','ROLE','it'),
(395,'ItemShelving','*','READ','ALLOW','ROLE','employee'), (395,'ItemShelving','*','READ','ALLOW','ROLE','employee'),
(396,'ItemShelving','*','WRITE','ALLOW','ROLE','production'), (396,'ItemShelving','*','WRITE','ALLOW','ROLE','production'),
(397,'ItemShelvingPlacementSupplyStock','*','READ','ALLOW','ROLE','employee'); (397,'ItemShelvingPlacementSupplyStock','*','READ','ALLOW','ROLE','employee'),
(407, 'ZipConfig', '*', '*', 'ALLOW', 'ROLE', 'employee');
/*!40000 ALTER TABLE `ACL` ENABLE KEYS */; /*!40000 ALTER TABLE `ACL` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;

View File

@ -1378,16 +1378,16 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1), (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1),
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2); (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2);
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `ref`,`isExcludedFromAvailable`, `isRaid`, `notes`, `evaNotes`) INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `notes`, `evaNotes`)
VALUES VALUES
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'Movement 1', 0, 0, '', ''), (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, '', ''),
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'Movement 2', 0, 0, 'this is the note two', 'observation two'), (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'this is the note two', 'observation two'),
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'Movement 3', 0, 0, 'this is the note three', 'observation three'), (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'this is the note three', 'observation three'),
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'Movement 4', 0, 0, 'this is the note four', 'observation four'), (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'this is the note four', 'observation four'),
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'Movement 5', 0, 0, 'this is the note five', 'observation five'), (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'this is the note five', 'observation five'),
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'Movement 6', 0, 0, 'this is the note six', 'observation six'), (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'this is the note six', 'observation six'),
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'), (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'),
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 8', 1, 1, '', ''); (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, '', '');
INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`) INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`)
VALUES VALUES

View File

@ -19560,6 +19560,7 @@ CREATE TABLE `notificationSubscription` (
-- Table structure for table `version` -- Table structure for table `version`
-- --
DROP TABLE IF EXISTS `version`; DROP TABLE IF EXISTS `version`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
@ -19581,7 +19582,7 @@ DROP TABLE IF EXISTS `versionLog`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `versionLog` ( CREATE TABLE `versionLog` (
`code` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL, `code` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
`number` char(11) COLLATE utf8mb3_unicode_ci NOT NULL, `number` char(11) COLLATE utf8mb3_unicode_ci NOT NULL,
`file` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL, `file` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL,
`user` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL, `user` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
@ -36304,8 +36305,6 @@ CREATE TABLE `ticketDown_SelectionType` (
-- Table structure for table `ticketLastState` -- Table structure for table `ticketLastState`
-- --
/
DROP TABLE IF EXISTS `ticketLastState`; DROP TABLE IF EXISTS `ticketLastState`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -76989,9 +76988,6 @@ DELIMITER ;
-- Current Database: `account` -- Current Database: `account`
-- --
-- Fix strucuture -- Fix strucuture
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('ZipConfig', '*', '*', 'ALLOW', 'ROLE', 'employee');
DROP TABLE IF EXISTS `vn`.`zipConfig`; DROP TABLE IF EXISTS `vn`.`zipConfig`;
CREATE TABLE `vn`.`zipConfig` ( CREATE TABLE `vn`.`zipConfig` (
@ -80027,3 +80023,4 @@ USE `vncontrol`;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2022-11-21 7:57:28 -- Dump completed on 2022-11-21 7:57:28

View File

@ -154,8 +154,8 @@ module.exports = Self => {
e.id, e.id,
e.supplierFk, e.supplierFk,
e.dated, e.dated,
e.ref reference, e.reference,
e.ref invoiceNumber, e.invoiceNumber,
e.isBooked, e.isBooked,
e.isExcludedFromAvailable, e.isExcludedFromAvailable,
e.notes, e.notes,

View File

@ -19,16 +19,10 @@
"type": "date" "type": "date"
}, },
"reference": { "reference": {
"type": "string", "type": "string"
"mysql": {
"columnName": "ref"
}
}, },
"invoiceNumber": { "invoiceNumber": {
"type": "string", "type": "string"
"mysql": {
"columnName": "ref"
}
}, },
"isBooked": { "isBooked": {
"type": "boolean" "type": "boolean"

View File

@ -89,7 +89,7 @@ module.exports = Self => {
ENGINE = MEMORY ENGINE = MEMORY
SELECT SELECT
e.id, e.id,
e.ref, e.reference,
e.supplierFk, e.supplierFk,
t.shipped t.shipped
FROM vn.entry e FROM vn.entry e

View File

@ -41,7 +41,8 @@
<vn-th field="data">Date</vn-th> <vn-th field="data">Date</vn-th>
<vn-td>{{::entry.shipped | date: 'dd/MM/yyyy'}}</vn-td> <vn-td>{{::entry.shipped | date: 'dd/MM/yyyy'}}</vn-td>
<vn-th field="ref">Reference</vn-th> <vn-th field="ref">Reference</vn-th>
<vn-td vn-tooltip="{{::entry.ref}}">{{::entry.ref}}</vn-td> ///REVISAR
<vn-td vn-tooltip="{{::entry.reference}}">{{::entry.reference}}</vn-td>
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>

View File

@ -1,3 +1,2 @@
Total entry: Total entrada Total entry: Total entrada
This supplier doesn't have a contact with an email address: Este proveedor no tiene ningún contacto con una dirección de email This supplier doesn't have a contact with an email address: Este proveedor no tiene ningún contacto con una dirección de email

View File

@ -159,7 +159,8 @@ module.exports = Self => {
`SELECT `SELECT
e.id, e.id,
e.travelFk, e.travelFk,
e.ref, e.reference,
e.invoiceNumber,
e.loadPriority, e.loadPriority,
s.id AS supplierFk, s.id AS supplierFk,
s.name AS supplierName, s.name AS supplierName,

View File

@ -1,4 +1,4 @@
/* eslint max-len: ["error", { "code": 150 }]*/
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
module.exports = Self => { module.exports = Self => {
Self.remoteMethod('getEntries', { Self.remoteMethod('getEntries', {
@ -25,17 +25,24 @@ module.exports = Self => {
let stmt; let stmt;
stmt = new ParameterizedSQL(` stmt = new ParameterizedSQL(`
SELECT e.travelFk, e.id, e.isConfirmed, e.ref, e.notes, e.evaNotes AS observation, SELECT
s.name AS supplierName, e.travelFk,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap)) e.id,
* b.stickers)/1000000)/((pcc.width*pcc.depth*pcc.height)/1000000) AS DECIMAL(10,2)) cc, e.isConfirmed,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap)) e.invoiceNumber,
* b.stickers)/1000000)/((ppallet.width*ppallet.depth*ppallet.height)/1000000) AS DECIMAL(10,2)) pallet, e.reference,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap)) e.notes,
* b.stickers)/1000000) AS DECIMAL(10,2)) m3, e.evaNotes AS observation,
TRUNCATE(SUM(b.stickers)/(COUNT( b.id) / COUNT( DISTINCT b.id)),0) hb, s.name AS supplierName,
CAST(SUM(b.freightValue*b.quantity) AS DECIMAL(10,2)) freightValue, CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))
CAST(SUM(b.packageValue*b.quantity) AS DECIMAL(10,2)) packageValue * b.stickers)/1000000)/((pcc.width*pcc.depth*pcc.height)/1000000) AS DECIMAL(10,2)) cc,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))
* b.stickers)/1000000)/((ppallet.width*ppallet.depth*ppallet.height)/1000000) AS DECIMAL(10,2)) pallet,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))
* b.stickers)/1000000) AS DECIMAL(10,2)) m3,
TRUNCATE(SUM(b.stickers)/(COUNT( b.id) / COUNT( DISTINCT b.id)),0) hb,
CAST(SUM(b.freightValue*b.quantity) AS DECIMAL(10,2)) freightValue,
CAST(SUM(b.packageValue*b.quantity) AS DECIMAL(10,2)) packageValue
FROM vn.travel t FROM vn.travel t
LEFT JOIN vn.entry e ON t.id = e.travelFk LEFT JOIN vn.entry e ON t.id = e.travelFk
LEFT JOIN vn.buy b ON b.entryFk = e.id LEFT JOIN vn.buy b ON b.entryFk = e.id

View File

@ -1,28 +1,34 @@
const app = require('vn-loopback/server/server'); const models = require('vn-loopback/server/server').models;
describe('travel getEntries()', () => { describe('travel getEntries()', () => {
const travelId = 1; const travelId = 1;
it('should check the response contains the id', async() => { it('should check the response contains the id', async() => {
const entries = await app.models.Travel.getEntries(travelId); const entries = await models.Travel.getEntries(travelId);
expect(entries.length).toEqual(1); expect(entries.length).toEqual(1);
expect(entries[0].id).toEqual(1); expect(entries[0].id).toEqual(1);
}); });
it('should check the response contains the travelFk', async() => { it('should check the response contains the travelFk', async() => {
const entries = await app.models.Travel.getEntries(travelId); const entries = await models.Travel.getEntries(travelId);
expect(entries[0].travelFk).toEqual(1); expect(entries[0].travelFk).toEqual(1);
}); });
it('should check the response contains the ref', async() => { it('should check the response contains the reference', async() => {
const entries = await app.models.Travel.getEntries(travelId); const entries = await models.Travel.getEntries(travelId);
expect(entries[0].ref).toEqual('Movement 1'); expect(entries[0].reference).toEqual('Movement 1');
});
it('should check the response contains the invoiceNumber', async() => {
const entries = await models.Travel.getEntries(travelId);
expect(entries[0].invoiceNumber).toEqual('IN2001');
}); });
it('should check the response contains the m3', async() => { it('should check the response contains the m3', async() => {
const entries = await app.models.Travel.getEntries(travelId); const entries = await models.Travel.getEntries(travelId);
expect(entries[0].m3).toEqual(0.22); expect(entries[0].m3).toEqual(0.22);
}); });