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'),
(395,'ItemShelving','*','READ','ALLOW','ROLE','employee'),
(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 */;
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),
(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
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, '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'),
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, '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'),
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, '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'),
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, '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, '', '');
(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, '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, '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, '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, '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, '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, '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, 'IN2008', 'Movement 8', 1, 1, '', '');
INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`)
VALUES

View File

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

View File

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

View File

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

View File

@ -89,7 +89,7 @@ module.exports = Self => {
ENGINE = MEMORY
SELECT
e.id,
e.ref,
e.reference,
e.supplierFk,
t.shipped
FROM vn.entry e
@ -104,7 +104,7 @@ module.exports = Self => {
const entriesIndex = stmts.push('SELECT * FROM tmp.entry') - 1;
stmt = new ParameterizedSQL(
`SELECT
`SELECT
b.id AS buyId,
b.itemFk,
b.entryFk,

View File

@ -31,8 +31,8 @@
</vn-button>
</vn-tool-bar>
</section>
<vn-table model="model"
ng-repeat="entry in entries"
<vn-table model="model"
ng-repeat="entry in entries"
ng-if="entry.buys">
<vn-thead>
<vn-tr>
@ -41,7 +41,8 @@
<vn-th field="data">Date</vn-th>
<vn-td>{{::entry.shipped | date: 'dd/MM/yyyy'}}</vn-td>
<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-thead>
<vn-tbody>
@ -83,8 +84,8 @@
</vn-table>
</vn-card>
</vn-data-viewer>
<vn-confirm
vn-id="confirm"
<vn-confirm
vn-id="confirm"
question="Please, confirm"
message="The consumption report will be sent"
on-accept="$ctrl.sendEmail()">

View File

@ -1,3 +1,2 @@
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
e.id,
e.travelFk,
e.ref,
e.reference,
e.invoiceNumber,
e.loadPriority,
s.id AS supplierFk,
s.name AS supplierName,
@ -168,7 +169,7 @@ module.exports = Self => {
e.notes,
CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg,
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 buy b ON b.entryFk = e.id
JOIN packaging pkg ON pkg.id = b.packageFk

View File

@ -1,4 +1,4 @@
/* eslint max-len: ["error", { "code": 150 }]*/
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
module.exports = Self => {
Self.remoteMethod('getEntries', {
@ -25,27 +25,34 @@ module.exports = Self => {
let stmt;
stmt = new ParameterizedSQL(`
SELECT e.travelFk, e.id, e.isConfirmed, e.ref, e.notes, e.evaNotes AS observation,
s.name AS supplierName,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))
* 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
SELECT
e.travelFk,
e.id,
e.isConfirmed,
e.invoiceNumber,
e.reference,
e.notes,
e.evaNotes AS observation,
s.name AS supplierName,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))
* 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
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.supplier s ON e.supplierFk = s.id
LEFT JOIN vn.supplier s ON e.supplierFk = s.id
JOIN vn.item i ON i.id = b.itemFk
LEFT JOIN vn.packaging p ON p.id = b.packageFk
JOIN vn.packaging pcc ON pcc.id = 'cc'
JOIN vn.packaging ppallet ON ppallet.id = 'pallet 100'
JOIN vn.packagingConfig pconfig
WHERE t.id = ?
WHERE t.id = ?
GROUP BY e.id;`, [
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()', () => {
const travelId = 1;
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[0].id).toEqual(1);
});
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);
});
it('should check the response contains the ref', async() => {
const entries = await app.models.Travel.getEntries(travelId);
it('should check the response contains the reference', async() => {
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() => {
const entries = await app.models.Travel.getEntries(travelId);
const entries = await models.Travel.getEntries(travelId);
expect(entries[0].m3).toEqual(0.22);
});

View File

@ -1,6 +1,6 @@
<vn-card class="summary">
<h5>
<a
<a
ng-if="::$ctrl.travelData.id"
vn-tooltip="Go to the travel"
ui-sref="travel.card.summary({id: {{::$ctrl.travelData.id}}})"
@ -13,15 +13,15 @@
<vn-horizontal>
<vn-one>
<vn-label-value
label="Shipped"
label="Shipped"
value="{{$ctrl.travelData.shipped | date: 'dd/MM/yyyy'}}">
</vn-label-value>
<vn-label-value
label="Warehouse Out"
label="Warehouse Out"
value="{{$ctrl.travelData.warehouseOut.name}}">
</vn-label-value>
<vn-check
label="Delivered"
label="Delivered"
ng-model="$ctrl.travelData.isDelivered"
disabled="true">
</vn-check>
@ -36,7 +36,7 @@
value="{{$ctrl.travelData.warehouseIn.name}}">
</vn-label-value>
<vn-check
label="Received"
label="Received"
ng-model="$ctrl.travelData.isReceived"
disabled="true">
</vn-check>
@ -80,7 +80,7 @@
<vn-tbody>
<vn-tr ng-repeat="entry in $ctrl.entries">
<vn-td shrink>
<vn-check
<vn-check
ng-model="entry.isConfirmed"
disabled="true">
</vn-check>
@ -99,7 +99,7 @@
<vn-td shrink>{{entry.cc}}</vn-td>
<vn-td shrink>{{entry.pallet}}</vn-td>
<vn-td shrink>{{entry.m3}}</vn-td>
<vn-td shrink>
<vn-td shrink>
<vn-icon
ng-if="entry.notes.length"
vn-tooltip="{{entry.notes}}"
@ -134,13 +134,13 @@
</vn-auto>
<vn-auto ng-if="$ctrl.travelThermographs.length != 0">
<h4 ng-show="$ctrl.isBuyer">
<a
<a
ui-sref="travel.card.thermograph.index({id:$ctrl.travelData.id})"
target="_self">
<span translate vn-tooltip="Go to">Thermograph</span>
</a>
</h4>
<h4
<h4
translate
ng-show="!$ctrl.isBuyer">
Thermograph
@ -168,6 +168,6 @@
</vn-auto>
</vn-horizontal>
</vn-card>
<vn-entry-descriptor-popover
<vn-entry-descriptor-popover
vn-id="entryDescriptor">
</vn-entry-descriptor-popover>
</vn-entry-descriptor-popover>