Merge branch 'dev' into 7207-showPbx
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
f5a43962fd
|
@ -45,7 +45,7 @@ BEGIN
|
|||
LEFT JOIN observation ob ON ob.ticketFk = t.id
|
||||
WHERE t.id = vParamFk
|
||||
AND t.shipped >= vYesterday
|
||||
UNION ALL
|
||||
UNION
|
||||
SELECT t.id ticketFk,
|
||||
IF(NOT(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`,
|
||||
am.name agencyName,
|
||||
|
@ -66,7 +66,7 @@ BEGIN
|
|||
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
|
||||
LEFT JOIN observation ob ON ob.ticketFk = t.id
|
||||
WHERE tc.collectionFk = vParamFk
|
||||
UNION ALL
|
||||
UNION
|
||||
SELECT sg.ticketFk,
|
||||
NULL `level`,
|
||||
am.name agencyName,
|
||||
|
@ -83,6 +83,7 @@ BEGIN
|
|||
LEFT JOIN observation ob ON ob.ticketFk = t.id
|
||||
LEFT JOIN vn.client c ON c.id = t.clientFk
|
||||
WHERE sc.id = vParamFk
|
||||
AND t.shipped >= vYesterday;
|
||||
AND t.shipped >= vYesterday
|
||||
GROUP BY ticketFk;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_deleteAdded`(
|
||||
vSelf INT(11)
|
||||
)
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Borra una reservea devolviendo la cantidad al itemShelving
|
||||
*
|
||||
* @param vSelf Identificador del itemShelvingSale
|
||||
*/
|
||||
DECLARE vSaleFk INT;
|
||||
DECLARE vHasSalesPicked BOOL;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
SELECT iss.saleFk INTO vSaleFk
|
||||
FROM itemShelvingSale iss
|
||||
JOIN sale s ON s.id = iss.saleFk
|
||||
WHERE iss.id = vSelf AND s.isAdded
|
||||
FOR UPDATE;
|
||||
|
||||
IF vSaleFk IS NULL THEN
|
||||
CALL util.throw('The sale can not be deleted');
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO vHasSalesPicked
|
||||
FROM itemShelvingSale
|
||||
WHERE saleFk = vSaleFk AND isPicked;
|
||||
|
||||
IF vHasSalesPicked THEN
|
||||
CALL util.throw('A sale with picked sales cannot be deleted');
|
||||
END IF;
|
||||
|
||||
UPDATE itemShelvingSale iss
|
||||
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||
SET ish.available = ish.available + iss.quantity
|
||||
WHERE iss.saleFk = vSaleFk;
|
||||
|
||||
DELETE FROM sale WHERE id = vSaleFk;
|
||||
|
||||
COMMIT;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -10,7 +10,7 @@ BEGIN
|
|||
END IF;
|
||||
|
||||
IF NEW.shelvingFk <> OLD.shelvingFk THEN
|
||||
SET NEW.isMoving = FALSE;
|
||||
SET NEW.movingState = NULL;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/*
|
||||
UPDATE vn.sale
|
||||
SET originalQuantity = quantity
|
||||
WHERE originalQuantity IS NULL
|
||||
*/
|
||||
|
|
|
@ -1 +1 @@
|
|||
ALTER TABLE vn.sale MODIFY COLUMN originalQuantity decimal(10,2) DEFAULT 0.00 NOT NULL COMMENT 'Se utiliza para notificar a través de rocket los cambios de quantity';
|
||||
-- ALTER TABLE vn.sale MODIFY COLUMN originalQuantity decimal(10,2) DEFAULT 0.00 NOT NULL COMMENT 'Se utiliza para notificar a través de rocket los cambios de quantity';
|
|
@ -0,0 +1,3 @@
|
|||
-- Place your SQL code here
|
||||
ALTER TABLE vn.itemShelving DROP COLUMN IF EXISTS isMoving;
|
||||
ALTER TABLE vn.itemShelving ADD IF NOT EXISTS movingState ENUM('selected','printed') NULL;
|
|
@ -0,0 +1,3 @@
|
|||
-- Place your SQL code here
|
||||
ALTER TABLE hedera.`order` ADD IF NOT EXISTS rowUpdated DATETIME NULL
|
||||
COMMENT 'Timestamp for last updated record in orderRow table';
|
|
@ -0,0 +1,45 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getWithPackaging', {
|
||||
description: 'Returns the list of suppliers with an entry of type packaging',
|
||||
accessType: 'READ',
|
||||
returns: {
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/getWithPackaging`,
|
||||
verb: 'GET'
|
||||
},
|
||||
nolimit: true
|
||||
});
|
||||
Self.getWithPackaging = async options => {
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
const oneYearAgo = new Date();
|
||||
oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const entries = await models.Entry.find({
|
||||
where: {
|
||||
typeFk: 'packaging',
|
||||
created: {gte: oneYearAgo}
|
||||
},
|
||||
include: {
|
||||
relation: 'supplier',
|
||||
scope: {
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
},
|
||||
fields: {supplierFk: true}
|
||||
}, myOptions);
|
||||
|
||||
const result = entries.map(item => ({
|
||||
id: item.supplier().id,
|
||||
name: item.supplier().name
|
||||
}));
|
||||
return Array.from(new Map(result.map(entry => [entry.id, entry])).values());
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
describe('Supplier getWithPackaging()', () => {
|
||||
it('should return a list of suppliers with an entry of type packaging', async() => {
|
||||
const typeFk = 'packaging';
|
||||
|
||||
const tx = await models.Supplier.beginTransaction({});
|
||||
const myOptions = {transaction: tx};
|
||||
|
||||
try {
|
||||
const entry = await models.Entry.findOne(
|
||||
{
|
||||
where: {
|
||||
id: 1
|
||||
},
|
||||
myOptions
|
||||
});
|
||||
|
||||
await entry.updateAttributes({
|
||||
typeFk: typeFk,
|
||||
created: new Date()
|
||||
});
|
||||
|
||||
const result = await models.Supplier.getWithPackaging(myOptions);
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -12,6 +12,7 @@ module.exports = Self => {
|
|||
require('../methods/supplier/campaignMetricsEmail')(Self);
|
||||
require('../methods/supplier/newSupplier')(Self);
|
||||
require('../methods/supplier/getItemsPackaging')(Self);
|
||||
require('../methods/supplier/getWithPackaging')(Self);
|
||||
|
||||
Self.validatesPresenceOf('name', {
|
||||
message: 'The social name cannot be empty'
|
||||
|
|
Loading…
Reference in New Issue