Merge branch 'dev' into 7187-redirect
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
8e5d12a6cb
|
@ -39,8 +39,6 @@ module.exports = Self => {
|
|||
const xmlString = response.data;
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
||||
const [resultElement] = xmlDoc.getElementsByTagName('Mensaje');
|
||||
|
||||
return resultElement.textContent;
|
||||
return xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -42,7 +42,8 @@ module.exports = Self => {
|
|||
throw new UserError(`Some mrwConfig parameters are not set`);
|
||||
|
||||
const query =
|
||||
`SELECT CASE co.code
|
||||
`SELECT
|
||||
CASE co.code
|
||||
WHEN 'ES' THEN a.postalCode
|
||||
WHEN 'PT' THEN LEFT(a.postalCode, 4)
|
||||
WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00')
|
||||
|
@ -89,14 +90,9 @@ module.exports = Self => {
|
|||
const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}, 'text/xml');
|
||||
const file = getTextByTag(getLabelResponse, 'EtiquetaFile');
|
||||
|
||||
try {
|
||||
await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, myOptions);
|
||||
if (tx) await tx.commit();
|
||||
} catch (error) {
|
||||
if (tx) await tx.rollback();
|
||||
throw error;
|
||||
}
|
||||
return file;
|
||||
|
||||
return {shipmentId, file};
|
||||
};
|
||||
|
||||
function getTextByTag(xmlDoc, tag) {
|
||||
|
|
|
@ -81,9 +81,9 @@ describe('MRWConfig createShipment()', () => {
|
|||
|
||||
spyOn(axios, 'post').and.callFake(() => Promise.resolve(mockPostResponses.pop()));
|
||||
|
||||
const base64Binary = await models.MrwConfig.createShipment(expedition1.id, options);
|
||||
const {file} = await models.MrwConfig.createShipment(expedition1.id, options);
|
||||
|
||||
expect(base64Binary).toEqual(mockBase64Binary);
|
||||
expect(file).toEqual(mockBase64Binary);
|
||||
});
|
||||
|
||||
it('should fail if mrwConfig has no data', async() => {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`client_userDisable`
|
||||
ON SCHEDULE EVERY 1 MONTH
|
||||
STARTS '2023-06-01 00:00:00.000'
|
||||
ON COMPLETION PRESERVE
|
||||
ENABLE
|
||||
DO CALL client_userDisable()$$
|
||||
DELIMITER ;
|
|
@ -1,25 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`clientsDisable`
|
||||
ON SCHEDULE EVERY 1 MONTH
|
||||
STARTS '2023-06-01 00:00:00.000'
|
||||
ON COMPLETION PRESERVE
|
||||
ENABLE
|
||||
DO BEGIN
|
||||
UPDATE account.user u
|
||||
JOIN client c ON c.id = u.id
|
||||
LEFT JOIN account.account a ON a.id = u.id
|
||||
SET u.active = FALSE
|
||||
WHERE c.typeFk = 'normal'
|
||||
AND a.id IS NULL
|
||||
AND u.active
|
||||
AND c.created < util.VN_CURDATE() - INTERVAL 12 MONTH
|
||||
AND u.id NOT IN (
|
||||
SELECT DISTINCT c.id
|
||||
FROM client c
|
||||
LEFT JOIN ticket t ON t.clientFk = c.id
|
||||
WHERE c.salesPersonFk IS NOT NULL
|
||||
OR t.created > util.VN_CURDATE() - INTERVAL 12 MONTH
|
||||
OR shipped > util.VN_CURDATE() - INTERVAL 12 MONTH
|
||||
);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,59 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_clone`(vEntryFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Clone buys to an entry
|
||||
*
|
||||
* @param vEntryFk The entry id
|
||||
* @table tmp.buy(id)
|
||||
*/
|
||||
INSERT INTO buy(
|
||||
entryFk,
|
||||
itemFk,
|
||||
quantity,
|
||||
buyingValue,
|
||||
freightValue,
|
||||
isIgnored,
|
||||
stickers,
|
||||
packagingFk,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
minPrice,
|
||||
isChecked,
|
||||
location,
|
||||
weight,
|
||||
itemOriginalFk)
|
||||
SELECT vEntryFk,
|
||||
b.itemFk,
|
||||
b.quantity,
|
||||
b.buyingValue,
|
||||
b.freightValue,
|
||||
b.isIgnored,
|
||||
b.stickers,
|
||||
b.packagingFk,
|
||||
b.packing,
|
||||
b.`grouping`,
|
||||
b.groupingMode,
|
||||
b.containerFk,
|
||||
b.comissionValue,
|
||||
b.packageValue,
|
||||
b.price1,
|
||||
b.price2,
|
||||
b.price3,
|
||||
b.minPrice,
|
||||
b.isChecked,
|
||||
b.location,
|
||||
b.weight,
|
||||
b.itemOriginalFk
|
||||
FROM tmp.buy tb
|
||||
JOIN vn.buy b ON b.id = tb.id;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,33 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_userDisable`()
|
||||
BEGIN
|
||||
/**
|
||||
* Desactiva los clientes inactivos en los últimos X meses.
|
||||
*/
|
||||
DECLARE vMonths INT;
|
||||
|
||||
SELECT monthsToDisableUser INTO vMonths
|
||||
FROM clientConfig;
|
||||
|
||||
IF vMonths IS NULL THEN
|
||||
CALL util.throw('Config parameter not set');
|
||||
END IF;
|
||||
|
||||
UPDATE account.user u
|
||||
JOIN client c ON c.id = u.id
|
||||
LEFT JOIN account.account a ON a.id = u.id
|
||||
SET u.active = FALSE
|
||||
WHERE c.typeFk = 'normal'
|
||||
AND a.id IS NULL
|
||||
AND u.active
|
||||
AND c.created < util.VN_CURDATE() - INTERVAL vMonths MONTH
|
||||
AND u.id NOT IN (
|
||||
SELECT DISTINCT c.id
|
||||
FROM client c
|
||||
LEFT JOIN ticket t ON t.clientFk = c.id
|
||||
WHERE c.salesPersonFk IS NOT NULL
|
||||
OR t.created > util.VN_CURDATE() - INTERVAL vMonths MONTH
|
||||
OR shipped > util.VN_CURDATE() - INTERVAL vMonths MONTH
|
||||
);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -9,8 +9,8 @@ BEGIN
|
|||
* Clones an entry header.
|
||||
*
|
||||
* @param vSelf The entry id
|
||||
* @param OUT vNewEntryFk The new entry id
|
||||
* @param vTravelFk Travel for the new entry or %NULL to use the source entry travel
|
||||
* @param vNewEntryFk The new entry id
|
||||
*/
|
||||
INSERT INTO entry(
|
||||
travelFk,
|
||||
|
|
|
@ -1,59 +1,18 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_copyBuys`(vSelf INT, vCopyTo INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_copyBuys`(vSelf INT, vDestinationEntryFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Copies an entry buys to another buy.
|
||||
* Copies all buys from an entry to an entry.
|
||||
*
|
||||
* @param vSelf The entry id
|
||||
* @param vCopyTo The destination entry id
|
||||
* @param vDestinationEntryFk The destination entry id
|
||||
*/
|
||||
INSERT INTO buy(
|
||||
entryFk,
|
||||
itemFk,
|
||||
quantity,
|
||||
buyingValue,
|
||||
freightValue,
|
||||
isIgnored,
|
||||
stickers,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
packagingFk,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
minPrice,
|
||||
isChecked,
|
||||
location,
|
||||
weight,
|
||||
itemOriginalFk
|
||||
)
|
||||
SELECT vCopyTo,
|
||||
itemFk,
|
||||
quantity,
|
||||
buyingValue,
|
||||
freightValue,
|
||||
isIgnored,
|
||||
stickers,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
packagingFk,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
minPrice,
|
||||
isChecked,
|
||||
location,
|
||||
weight,
|
||||
itemOriginalFk
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buy
|
||||
SELECT id
|
||||
FROM buy
|
||||
WHERE entryFk = vSelf;
|
||||
|
||||
CALL buy_clone(vDestinationEntryFk);
|
||||
DROP TEMPORARY TABLE tmp.buy;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_getItemDetails`(
|
||||
vBarcodeItem INT,
|
||||
vShelvingFK VARCHAR(10)
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Obtiene el precio y visible de un item
|
||||
*
|
||||
* @param vBarcodeItem barcode de artículo
|
||||
* @param vShelvingFK Ubicación actual del artículo
|
||||
*/
|
||||
DECLARE vIsItem BOOL;
|
||||
DECLARE vBuyFk INT;
|
||||
DECLARE vWarehouseFk INT;
|
||||
|
||||
SELECT COUNT(*) > 0 INTO vIsItem
|
||||
FROM item
|
||||
WHERE id = vBarcodeItem;
|
||||
|
||||
IF vIsItem THEN
|
||||
SELECT warehouseFk INTO vWarehouseFk
|
||||
FROM operator
|
||||
WHERE workerFk = account.myUser_getId();
|
||||
|
||||
CALL buyUltimate(vWarehouseFk, util.VN_CURDATE());
|
||||
|
||||
SELECT buyFk INTO vBuyFk
|
||||
FROM tmp.buyUltimate
|
||||
WHERE itemFk = vBarcodeItem
|
||||
AND warehouseFk = vWarehouseFk;
|
||||
|
||||
DELETE FROM tmp.buyUltimate;
|
||||
ELSE
|
||||
SELECT vBarcodeItem INTO vBuyFk;
|
||||
END IF;
|
||||
|
||||
WITH visible AS(
|
||||
SELECT itemFk,
|
||||
IFNULL(buyingValue, 0) +
|
||||
IFNULL(freightValue, 0) +
|
||||
IFNULL(comissionValue, 0) +
|
||||
IFNULL(packageValue, 0) itemCost
|
||||
FROM vn.buy b
|
||||
WHERE b.id = vBuyFk
|
||||
) SELECT v.itemFk,
|
||||
vShelvingFK,
|
||||
v.itemCost,
|
||||
SUM(ish.visible) visible
|
||||
FROM vn.itemShelving ish
|
||||
JOIN visible v
|
||||
WHERE ish.shelvingFK = vShelvingFK COLLATE utf8mb3_general_ci
|
||||
AND ish.itemFk = v.itemFk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,411 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_devalueA2`(
|
||||
vSelf INT,
|
||||
vShelvingFK VARCHAR(10),
|
||||
vBuyingValue DECIMAL(10,4),
|
||||
vQuantity INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Devalua un item modificando su calidad de A1 a A2.
|
||||
* Si no existe el item A2 lo crea y genera los movimientos de las entradas
|
||||
* de almacén y shelvings correspondientes
|
||||
*
|
||||
* @param vSelf Id de artículo a devaluar
|
||||
* @param vShelvingFK Ubicación actual del artículo
|
||||
* @param vBuyingValue Nuevo precio de coste
|
||||
* @param vQuantity Cantidad del ítem a pasar a A2
|
||||
*/
|
||||
DECLARE vItemA2Fk INT;
|
||||
DECLARE vLastBuyFk BIGINT;
|
||||
DECLARE vA1BuyFk INT;
|
||||
DECLARE vA2BuyFk INT;
|
||||
DECLARE vTargetEntryFk INT;
|
||||
DECLARE vTargetEntryDate DATE;
|
||||
DECLARE vTargetItemShelvingFk BIGINT;
|
||||
DECLARE vWarehouseFk INT;
|
||||
DECLARE vCacheFk INT;
|
||||
DECLARE vLastEntryFk INT;
|
||||
DECLARE vCurrentVisible INT;
|
||||
DECLARE vDevalueTravelFk INT;
|
||||
DECLARE vCurdate DATE;
|
||||
DECLARE vBuyingValueOriginal DECIMAL(10,4);
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
IF (SELECT TRUE FROM item WHERE id = vSelf AND (category <> 'A1' OR category IS NULL)) THEN
|
||||
CALL util.throw('Item has not category A1');
|
||||
END IF;
|
||||
|
||||
SELECT warehouseFk INTO vWarehouseFk
|
||||
FROM userConfig
|
||||
WHERE userFk = account.myUser_getId();
|
||||
|
||||
IF NOT vWarehouseFk OR vWarehouseFk IS NULL THEN
|
||||
CALL util.throw ('Operator has not a valid warehouse');
|
||||
END IF;
|
||||
|
||||
IF vQuantity <= 0 OR vQuantity IS NULL THEN
|
||||
CALL util.throw ('The quantity is incorrect');
|
||||
END IF;
|
||||
|
||||
SELECT util.VN_CURDATE() INTO vCurdate;
|
||||
|
||||
SELECT t.id INTO vDevalueTravelFk
|
||||
FROM travel t
|
||||
JOIN travelConfig tc
|
||||
WHERE t.shipped = vCurdate
|
||||
AND t.landed = vCurdate
|
||||
AND t.warehouseInFk = vWarehouseFk
|
||||
AND t.warehouseOutFk = tc.devalueWarehouseOutFk
|
||||
AND t.agencyModeFk = tc.devalueAgencyModeFk
|
||||
LIMIT 1;
|
||||
|
||||
IF NOT vDevalueTravelFk OR vDevalueTravelFk IS NULL THEN
|
||||
INSERT INTO travel (
|
||||
shipped,
|
||||
landed,
|
||||
warehouseInFk,
|
||||
warehouseOutFk,
|
||||
`ref`,
|
||||
isReceived,
|
||||
agencyModeFk)
|
||||
SELECT vCurdate,
|
||||
vCurdate,
|
||||
vWarehouseFk,
|
||||
tc.devalueWarehouseOutFk,
|
||||
tc.devalueRef,
|
||||
TRUE,
|
||||
tc.devalueAgencyModeFk
|
||||
FROM travelConfig tc;
|
||||
SET vDevalueTravelFk = LAST_INSERT_ID();
|
||||
END IF;
|
||||
|
||||
SELECT id, DATE(dated) INTO vTargetEntryFk, vTargetEntryDate
|
||||
FROM `entry` e
|
||||
WHERE DATE(dated) = vCurdate
|
||||
AND typeFk = 'devaluation'
|
||||
AND travelFk = vDevalueTravelFk
|
||||
ORDER BY created DESC
|
||||
LIMIT 1;
|
||||
|
||||
CALL buyUltimate(vWarehouseFk, vCurdate);
|
||||
|
||||
SELECT b.entryFk, bu.buyFk,IFNULL(b.buyingValue, 0) INTO vLastEntryFk, vLastBuyFk, vBuyingValueOriginal
|
||||
FROM tmp.buyUltimate bu
|
||||
JOIN vn.buy b ON b.id = bu.buyFk
|
||||
WHERE bu.itemFk = vSelf
|
||||
AND bu.warehouseFk = vWarehouseFk;
|
||||
|
||||
IF vBuyingValue > vBuyingValueOriginal THEN
|
||||
CALL util.throw ('Price not valid');
|
||||
END IF;
|
||||
|
||||
IF vLastEntryFk IS NULL OR vLastBuyFk IS NULL THEN
|
||||
CALL util.throw ('The item has not a buy');
|
||||
END IF;
|
||||
|
||||
SELECT id,visible INTO vTargetItemShelvingFk, vCurrentVisible
|
||||
FROM itemShelving
|
||||
WHERE shelvingFk = vShelvingFK COLLATE utf8mb3_general_ci
|
||||
AND itemFk = vSelf
|
||||
LIMIT 1;
|
||||
|
||||
IF vCurrentVisible IS NULL THEN
|
||||
CALL util.throw ('The shelving has not a visible for this item');
|
||||
END IF;
|
||||
|
||||
IF vQuantity > vCurrentVisible THEN
|
||||
CALL util.throw('Quantity is greater than visible');
|
||||
END IF;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
IF NOT vTargetEntryFk OR vTargetEntryFk IS NULL
|
||||
OR NOT vTargetEntryDate <=> vCurdate THEN
|
||||
INSERT INTO entry(
|
||||
travelFk,
|
||||
supplierFk,
|
||||
dated,
|
||||
commission,
|
||||
currencyFk,
|
||||
companyFk,
|
||||
clonedFrom,
|
||||
typeFk
|
||||
)
|
||||
SELECT vDevalueTravelFk,
|
||||
supplierFk,
|
||||
vCurdate,
|
||||
commission,
|
||||
currencyFk,
|
||||
companyFk,
|
||||
vLastEntryFk,
|
||||
'devaluation'
|
||||
FROM entry
|
||||
WHERE id = vLastEntryFk;
|
||||
|
||||
SET vTargetEntryFk = LAST_INSERT_ID();
|
||||
END IF;
|
||||
|
||||
SELECT i.id INTO vItemA2Fk
|
||||
FROM item i
|
||||
JOIN (
|
||||
SELECT i.id,
|
||||
i.name,
|
||||
i.subname,
|
||||
i.value5,
|
||||
i.value6,
|
||||
i.value7,
|
||||
i.value8,
|
||||
i.value9,
|
||||
i.value10,
|
||||
i.NumberOfItemsPerCask,
|
||||
i.EmbalageCode,
|
||||
i.quality
|
||||
FROM item i
|
||||
WHERE i.id = vSelf
|
||||
)i2 ON i2.name <=> i.name
|
||||
AND i2.subname <=> i.subname
|
||||
AND i2.value5 <=> i.value5
|
||||
AND i2.value6 <=> i.value6
|
||||
AND i2.value8 <=> i.value8
|
||||
AND i2.value9 <=> i.value9
|
||||
AND i2.value10 <=> i.value10
|
||||
AND i2.NumberOfItemsPerCask <=> i.NumberOfItemsPerCask
|
||||
AND i2.EmbalageCode <=> i.EmbalageCode
|
||||
AND i2.quality <=> i.quality
|
||||
WHERE i.id <> i2.id
|
||||
AND i.category = 'A2'
|
||||
LIMIT 1;
|
||||
|
||||
IF vItemA2Fk IS NULL THEN
|
||||
INSERT INTO item (
|
||||
equivalent,
|
||||
name,
|
||||
`size`,
|
||||
stems,
|
||||
minPrice,
|
||||
isToPrint,
|
||||
family,
|
||||
box,
|
||||
category,
|
||||
originFk,
|
||||
doPhoto,
|
||||
image,
|
||||
inkFk,
|
||||
intrastatFk,
|
||||
hasMinPrice,
|
||||
created,
|
||||
comment,
|
||||
typeFk,
|
||||
generic,
|
||||
producerFk,
|
||||
description,
|
||||
density,
|
||||
relevancy,
|
||||
expenseFk,
|
||||
isActive,
|
||||
longName,
|
||||
subName,
|
||||
minimum,
|
||||
upToDown,
|
||||
supplyResponseFk,
|
||||
hasKgPrice,
|
||||
isFloramondo,
|
||||
isFragile,
|
||||
numberOfItemsPerCask,
|
||||
embalageCode,
|
||||
quality,
|
||||
stemMultiplier,
|
||||
itemPackingTypeFk,
|
||||
packingOut,
|
||||
genericFk,
|
||||
isLaid,
|
||||
lastUsed,
|
||||
weightByPiece,
|
||||
editorFk,
|
||||
recycledPlastic,
|
||||
nonRecycledPlastic)
|
||||
SELECT equivalent,
|
||||
name,
|
||||
`size`,
|
||||
stems,
|
||||
minPrice,
|
||||
isToPrint,
|
||||
family,
|
||||
box,
|
||||
'A2',
|
||||
originFk,
|
||||
doPhoto,
|
||||
image,
|
||||
inkFk,
|
||||
intrastatFk,
|
||||
hasMinPrice,
|
||||
created,
|
||||
comment,
|
||||
typeFk,
|
||||
generic,
|
||||
producerFk,
|
||||
description,
|
||||
density,
|
||||
relevancy,
|
||||
expenseFk,
|
||||
isActive,
|
||||
longName,
|
||||
subName,
|
||||
minimum,
|
||||
upToDown,
|
||||
supplyResponseFk,
|
||||
hasKgPrice,
|
||||
isFloramondo,
|
||||
isFragile,
|
||||
numberOfItemsPerCask,
|
||||
embalageCode,
|
||||
quality,
|
||||
stemMultiplier,
|
||||
itemPackingTypeFk,
|
||||
packingOut,
|
||||
genericFk,
|
||||
isLaid,
|
||||
lastUsed,
|
||||
weightByPiece,
|
||||
editorFk,
|
||||
recycledPlastic,
|
||||
nonRecycledPlastic
|
||||
FROM item
|
||||
WHERE id = vSelf;
|
||||
|
||||
SET vItemA2Fk = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO itemTag (itemFk, tagFk, `value`, intValue, priority, editorFk)
|
||||
SELECT vItemA2Fk, tagFk, `value`, intValue, priority, editorFk
|
||||
FROM itemTag
|
||||
WHERE id = vSelf;
|
||||
|
||||
UPDATE itemTaxCountry itc
|
||||
JOIN itemTaxCountry itc2 ON itc2.itemFk = vSelf
|
||||
AND itc2.countryFk = itc.countryFk
|
||||
SET itc2.taxClassFk = itc.taxClassFk
|
||||
WHERE itc.id = vItemA2Fk;
|
||||
|
||||
INSERT INTO itemBotanical (itemFk, genusFk, specieFk)
|
||||
SELECT vItemA2Fk, genusFk, specieFk
|
||||
FROM itemBotanical
|
||||
WHERE itemFk = vSelf;
|
||||
END IF;
|
||||
|
||||
IF vQuantity = vCurrentVisible THEN
|
||||
DELETE FROM itemShelving
|
||||
WHERE id = vTargetItemShelvingFk;
|
||||
ELSE
|
||||
UPDATE itemShelving
|
||||
SET visible = vCurrentVisible - vQuantity
|
||||
WHERE id = vTargetItemShelvingFk;
|
||||
END IF;
|
||||
|
||||
INSERT INTO buy(
|
||||
entryFk,
|
||||
itemFk,
|
||||
quantity,
|
||||
buyingValue,
|
||||
freightValue,
|
||||
isIgnored,
|
||||
stickers,
|
||||
packagingFk,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
minPrice,
|
||||
isChecked,
|
||||
location,
|
||||
weight,
|
||||
itemOriginalFk)
|
||||
SELECT vTargetEntryFk,
|
||||
itemFk,
|
||||
- LEAST(vQuantity, vCurrentVisible),
|
||||
buyingValue,
|
||||
freightValue,
|
||||
TRUE,
|
||||
stickers,
|
||||
packagingFk,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
minPrice,
|
||||
isChecked,
|
||||
location,
|
||||
weight,
|
||||
itemOriginalFk
|
||||
FROM vn.buy
|
||||
WHERE id = vLastBuyFk
|
||||
UNION
|
||||
SELECT vTargetEntryFk,
|
||||
vItemA2Fk,
|
||||
vQuantity,
|
||||
vBuyingValue,
|
||||
freightValue,
|
||||
TRUE,
|
||||
stickers,
|
||||
packagingFk,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
minPrice,
|
||||
isChecked,
|
||||
location,
|
||||
weight,
|
||||
itemOriginalFk
|
||||
FROM vn.buy
|
||||
WHERE id = vLastBuyFk;
|
||||
|
||||
INSERT IGNORE INTO itemShelving (
|
||||
itemFk,
|
||||
shelvingFk,
|
||||
visible,
|
||||
`grouping`,
|
||||
packing,
|
||||
packagingFk,
|
||||
userFk,
|
||||
isChecked)
|
||||
SELECT vItemA2Fk,
|
||||
shelvingFk,
|
||||
vQuantity ,
|
||||
`grouping`,
|
||||
packing,
|
||||
packagingFk,
|
||||
account.myUser_getId(),
|
||||
isChecked
|
||||
FROM itemShelving
|
||||
WHERE itemFK = vSelf
|
||||
AND shelvingFk = vShelvingFK COLLATE utf8mb3_general_ci
|
||||
ON DUPLICATE KEY UPDATE
|
||||
visible = vQuantity + VALUES(visible);
|
||||
|
||||
COMMIT;
|
||||
CALL cache.visible_refresh(vCacheFk, TRUE, vWarehouseFk);
|
||||
CALL cache.available_refresh(vCacheFk, TRUE, vWarehouseFk, vCurdate);
|
||||
CALL buy_recalcPricesByBuy(vA2BuyFk);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -35,7 +35,7 @@ BEGIN
|
|||
itemFk,
|
||||
longName,
|
||||
supplier,
|
||||
entryFk,
|
||||
CONCAT('E',entryFk) entryFk,
|
||||
landed,
|
||||
`in`,
|
||||
`out`,
|
||||
|
@ -49,16 +49,98 @@ BEGIN
|
|||
itemFk,
|
||||
longName,
|
||||
supplier,
|
||||
'previous',
|
||||
'E previous',
|
||||
vFromDated,
|
||||
SUM(`in`),
|
||||
SUM(`out`),
|
||||
NULL,
|
||||
buyingValue
|
||||
AVG(buyingValue)
|
||||
FROM supplierPackaging
|
||||
WHERE supplierFk = vSupplierFk
|
||||
AND landed < vFromDated
|
||||
GROUP BY itemFk
|
||||
UNION ALL
|
||||
SELECT vSupplierFk,
|
||||
s.itemFk,
|
||||
i.longName,
|
||||
c.name,
|
||||
CONCAT('T',s.ticketFk),
|
||||
DATE(t.shipped),
|
||||
-LEAST(s.quantity,0) `in`,
|
||||
GREATEST(s.quantity,0) `out`,
|
||||
t.warehouseFk,
|
||||
s.price * (100 - s.discount) / 100
|
||||
FROM sale s
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN packaging p ON p.itemFk = i.id
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
JOIN supplier su ON su.nif = c.fi
|
||||
WHERE su.id = vSupplierFk
|
||||
AND t.shipped >= vFromDated
|
||||
AND p.isPackageReturnable
|
||||
UNION ALL
|
||||
SELECT vSupplierFk,
|
||||
s.itemFk,
|
||||
i.longName,
|
||||
c.name,
|
||||
'T previous',
|
||||
vFromDated,
|
||||
SUM(-LEAST(s.quantity,0)) `in`,
|
||||
SUM(GREATEST(s.quantity,0)) `out`,
|
||||
NULL,
|
||||
AVG(s.price * (100 - s.discount) / 100)
|
||||
FROM sale s
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN packaging p ON p.itemFk = i.id
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
JOIN supplier su ON su.nif = c.fi
|
||||
WHERE su.id = vSupplierFk
|
||||
AND t.shipped < vFromDated
|
||||
AND p.isPackageReturnable
|
||||
GROUP BY s.itemFk
|
||||
UNION ALL
|
||||
SELECT vSupplierFk,
|
||||
p.itemFk,
|
||||
i.longName,
|
||||
c.name,
|
||||
CONCAT('TP',tp.ticketFk),
|
||||
DATE(t.shipped),
|
||||
-LEAST(tp.quantity,0) `in`,
|
||||
GREATEST(tp.quantity,0) `out`,
|
||||
t.warehouseFk,
|
||||
0
|
||||
FROM ticketPackaging tp
|
||||
JOIN packaging p ON p.id = tp.packagingFk
|
||||
JOIN item i ON i.id = p.itemFk
|
||||
JOIN ticket t ON t.id = tp.ticketFk
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
JOIN supplier su ON su.nif = c.fi
|
||||
WHERE su.id = vSupplierFk
|
||||
AND t.shipped >= vFromDated
|
||||
AND p.isPackageReturnable
|
||||
UNION ALL
|
||||
SELECT vSupplierFk,
|
||||
p.itemFk,
|
||||
i.longName,
|
||||
c.name,
|
||||
'TP previous',
|
||||
vFromDated,
|
||||
SUM(-LEAST(tp.quantity,0)) `in`,
|
||||
SUM(GREATEST(tp.quantity,0)) `out`,
|
||||
NULL,
|
||||
0
|
||||
FROM ticketPackaging tp
|
||||
JOIN packaging p ON p.id = tp.packagingFk
|
||||
JOIN item i ON i.id = p.itemFk
|
||||
JOIN ticket t ON t.id = tp.ticketFk
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
JOIN supplier su ON su.nif = c.fi
|
||||
WHERE su.id = vSupplierFk
|
||||
AND t.shipped >= vFromDated
|
||||
AND p.isPackageReturnable
|
||||
GROUP BY p.itemFk
|
||||
ORDER BY itemFk, landed, entryFk
|
||||
) sub
|
||||
WHERE `out` OR `in`;
|
||||
|
@ -69,8 +151,8 @@ BEGIN
|
|||
supplier,
|
||||
entryFk,
|
||||
landed,
|
||||
`in`,
|
||||
`out`,
|
||||
CAST(`in` AS DECIMAL(10,0)) `in`,
|
||||
CAST(`out` AS DECIMAL(10,0)) `out`,
|
||||
warehouse,
|
||||
buyingValue,
|
||||
balance
|
||||
|
|
|
@ -28,6 +28,5 @@ AS SELECT `c`.`id` AS `Id_Compra`,
|
|||
`c`.`workerFk` AS `Id_Trabajador`,
|
||||
`c`.`weight` AS `weight`,
|
||||
`c`.`dispatched` AS `dispatched`,
|
||||
`c`.`containerFk` AS `container_id`,
|
||||
`c`.`itemOriginalFk` AS `itemOriginalFk`
|
||||
FROM `vn`.`buy` `c`
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
INSERT IGNORE INTO vn.entryType (code, description)
|
||||
VALUES ('devaluation', 'Devaluación');
|
||||
|
||||
ALTER TABLE vn.travelConfig ADD IF NOT EXISTS devalueWarehouseOutFk SMALLINT(6) UNSIGNED NULL
|
||||
COMMENT 'Datos del travel para las entradas generadas al devaluar artículos de A1 a A2';
|
||||
|
||||
ALTER TABLE vn.travelConfig ADD IF NOT EXISTS devalueAgencyModeFk INT(11) NULL;
|
||||
ALTER TABLE vn.travelConfig ADD IF NOT EXISTS devalueRef varchar(20) NULL;
|
||||
|
||||
ALTER TABLE vn.travelConfig DROP FOREIGN KEY IF EXISTS travelConfig_agencyMode_FK;
|
||||
|
||||
ALTER TABLE vn.travelConfig ADD CONSTRAINT travelConfig_agencyMode_FK
|
||||
FOREIGN KEY (devalueAgencyModeFk) REFERENCES vn.agencyMode(id) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE vn.travelConfig DROP FOREIGN KEY IF EXISTS travelConfig_warehouse_FK;
|
||||
ALTER TABLE vn.travelConfig ADD CONSTRAINT travelConfig_warehouse_FK
|
||||
FOREIGN KEY (devalueWarehouseOutFk) REFERENCES vn.warehouse(id) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE vn.clientConfig
|
||||
ADD monthsToDisableUser int(10) unsigned DEFAULT NULL NULL;
|
||||
|
||||
UPDATE IGNORE vn.clientConfig
|
||||
SET monthsToDisableUser = 12;
|
|
@ -0,0 +1,26 @@
|
|||
DROP TABLE IF EXISTS vn2008.scanTree__;
|
||||
DROP TABLE IF EXISTS vn2008.payroll_embargos__;
|
||||
DROP TABLE IF EXISTS vn2008.unary_source__;
|
||||
DROP TABLE IF EXISTS vn2008.unary_scan__;
|
||||
DROP TABLE IF EXISTS vn2008.unary_scan_line_buy__;
|
||||
DROP TABLE IF EXISTS vn2008.unary_scan_line__;
|
||||
DROP TABLE IF EXISTS vn2008.scan_line__;
|
||||
DROP TABLE IF EXISTS vn2008.Familias__;
|
||||
DROP TABLE IF EXISTS vn2008.language__;
|
||||
DROP TABLE IF EXISTS vn2008.Clientes_dits__;
|
||||
DROP TABLE IF EXISTS vn2008.unary_scan_line_expedition__;
|
||||
DROP TABLE IF EXISTS vn2008.warehouse_group__;
|
||||
DROP TABLE IF EXISTS vn2008.Espionajes__;
|
||||
DROP TABLE IF EXISTS vn2008.jerarquia__;
|
||||
DROP TABLE IF EXISTS vn2008.wks__;
|
||||
DROP TABLE IF EXISTS vn2008.Proveedores_comunicados__;
|
||||
DROP TABLE IF EXISTS vn2008.integra2_escala__;
|
||||
DROP TABLE IF EXISTS vn2008.cp__;
|
||||
DROP TABLE IF EXISTS vn2008.unary__;
|
||||
DROP TABLE IF EXISTS vn2008.Estados__;
|
||||
DROP TABLE IF EXISTS vn2008.agency_hour__;
|
||||
DROP TABLE IF EXISTS vn2008.Reservas__;
|
||||
DROP TABLE IF EXISTS vn2008.cyc_declaration__;
|
||||
DROP TABLE IF EXISTS vn2008.route__;
|
||||
DROP TABLE IF EXISTS vn2008.Proveedores_escritos__;
|
||||
DROP TABLE IF EXISTS vn2008.config__;
|
|
@ -0,0 +1,41 @@
|
|||
DROP TABLE IF EXISTS vn2008.form_query__;
|
||||
DROP TABLE IF EXISTS vn2008.filtros__;
|
||||
DROP TABLE IF EXISTS vn2008.Objetivos__;
|
||||
UPDATE IGNORE vn.province
|
||||
SET zoneFk = NULL
|
||||
WHERE zoneFk IN (
|
||||
SELECT zoneFk
|
||||
FROM vn.province
|
||||
WHERE zoneFk IS NOT NULL AND zoneFk NOT IN (SELECT id FROM vn.`zone`)
|
||||
);
|
||||
ALTER TABLE vn.province DROP FOREIGN KEY province_zone_fk;
|
||||
ALTER TABLE vn.province MODIFY COLUMN zoneFk int(11) DEFAULT NULL NULL;
|
||||
ALTER TABLE vn.province ADD CONSTRAINT
|
||||
province_zone_FK FOREIGN KEY (zoneFk) REFERENCES vn.`zone`(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
DROP TABLE IF EXISTS vn2008.zones__;
|
||||
DROP TABLE IF EXISTS vn2008.rec_translator__;
|
||||
DROP TABLE IF EXISTS vn2008.warehouse_joined__;
|
||||
DROP TABLE IF EXISTS vn2008.warehouse_filtro__;
|
||||
DROP TABLE IF EXISTS vn2008.viaxpress__;
|
||||
DROP TABLE IF EXISTS vn2008.cl_que__;
|
||||
DROP TABLE IF EXISTS vn2008.Recibos_recorded__;
|
||||
RENAME TABLE vn.coolerPathDetail TO vn.coolerPathDetail__;
|
||||
ALTER TABLE vn.coolerPathDetail__ DROP FOREIGN KEY coolerPathDetail_FK;
|
||||
DROP TABLE IF EXISTS vn2008.cooler_path__;
|
||||
DROP TABLE IF EXISTS vn2008.payrroll_apEmpresarial__;
|
||||
DROP TABLE IF EXISTS vn2008.Compres_ok__;
|
||||
DROP TABLE IF EXISTS vn2008.Movimientos_avisar__;
|
||||
DROP TABLE IF EXISTS vn2008.Clases__;
|
||||
DROP TABLE IF EXISTS vn2008.payroll_basess__;
|
||||
DROP TABLE IF EXISTS vn2008.payroll_tipobasess__;
|
||||
DROP TABLE IF EXISTS vn2008.guillen__;
|
||||
DROP TABLE IF EXISTS vn2008.guillen_carry__;
|
||||
DROP TABLE IF EXISTS vn2008.Series__;
|
||||
DROP TABLE IF EXISTS vn2008.Permisos__;
|
||||
ALTER TABLE vn.buy DROP FOREIGN KEY buy_FK_1;
|
||||
DROP TABLE IF EXISTS vn2008.container__;
|
||||
DROP TABLE IF EXISTS vn2008.travel_reserve__;
|
||||
DROP TABLE IF EXISTS vn2008.tmpNEWTARIFAS__;
|
||||
DROP TABLE IF EXISTS vn2008.Clientes_potenciales__;
|
||||
DROP TABLE IF EXISTS vn2008.duaDismissed__;
|
||||
DROP TABLE IF EXISTS vn2008.cl_pet__;
|
|
@ -0,0 +1,27 @@
|
|||
DROP TABLE IF EXISTS vn2008.expeditions_deleted__;
|
||||
DROP TABLE IF EXISTS vn2008.Tipos_f11__;
|
||||
DROP TABLE IF EXISTS vn2008.commission__;
|
||||
DROP TABLE IF EXISTS vn2008.Movimientos_revisar__;
|
||||
DROP TABLE IF EXISTS vn2008.recibida_agricola__;
|
||||
DROP TABLE IF EXISTS vn2008.tipsa__;
|
||||
DROP TABLE IF EXISTS vn2008.rounding__;
|
||||
DROP TABLE IF EXISTS vn2008.Informes__;
|
||||
DROP TABLE IF EXISTS vn2008.Monitoring__;
|
||||
DROP TABLE IF EXISTS vn2008.Forms__;
|
||||
DROP TABLE IF EXISTS vn2008.Clientes_event__;
|
||||
DROP TABLE IF EXISTS vn2008.wh_selection__;
|
||||
DROP TABLE IF EXISTS vn2008.template_bionic_component__;
|
||||
DROP TABLE IF EXISTS vn2008.Agencias_province__;
|
||||
DROP TABLE IF EXISTS vn2008.travel_pattern__;
|
||||
DROP TABLE IF EXISTS vn2008.sort_merge_results_ernesto__;
|
||||
DROP TABLE IF EXISTS vn2008.Conteo__;
|
||||
DROP TABLE IF EXISTS vn2008.Consignatarios_devices__;
|
||||
DROP TABLE IF EXISTS vn2008.link__;
|
||||
DROP TABLE IF EXISTS vn2008.agency_warehouse__;
|
||||
DROP TABLE IF EXISTS vn2008.warehouse_lc__;
|
||||
DROP TABLE IF EXISTS vn2008.emp_day_pay__;
|
||||
DROP TABLE IF EXISTS vn2008.Entradas_kop__;
|
||||
DROP TABLE IF EXISTS vn2008.dock__;
|
||||
DROP TABLE IF EXISTS vn2008.unaryScanFilter__;
|
||||
DROP TABLE IF EXISTS vn2008.Grupos__;
|
||||
DROP TABLE IF EXISTS vn2008.nichos__;
|
|
@ -0,0 +1,26 @@
|
|||
DROP TABLE IF EXISTS vn2008.preparation_exception__;
|
||||
DROP TABLE IF EXISTS vn2008.Clientes_empresa__;
|
||||
DROP TABLE IF EXISTS vn2008.call_information__;
|
||||
DROP TABLE IF EXISTS vn2008.template_bionic_price__;
|
||||
DROP TABLE IF EXISTS vn2008.invoice_observation__;
|
||||
DROP TABLE IF EXISTS vn2008.edi_testigos__;
|
||||
DROP TABLE IF EXISTS vn2008.cl_dep__;
|
||||
DROP TABLE IF EXISTS vn2008.agencia_descuadre__;
|
||||
DROP TABLE IF EXISTS vn2008.payroll_datos__;
|
||||
DROP TABLE IF EXISTS vn2008.tblIVA__;
|
||||
DROP TABLE IF EXISTS vn2008.cyc__;
|
||||
DROP TABLE IF EXISTS vn2008.Tickets_stack__;
|
||||
DROP TABLE IF EXISTS vn2008.config_host_forms__;
|
||||
DROP TABLE IF EXISTS vn2008.template_bionic_lot__;
|
||||
DROP TABLE IF EXISTS vn2008.payroll_bonificaciones__;
|
||||
DROP TABLE IF EXISTS vn2008.widget__;
|
||||
DROP TABLE IF EXISTS vn2008.accion_dits__;
|
||||
DROP TABLE IF EXISTS vn2008.credit_card__;
|
||||
DROP TABLE IF EXISTS vn2008.Brasa__;
|
||||
DROP TABLE IF EXISTS vn2008.Jefes__;
|
||||
DROP TABLE IF EXISTS vn2008.call_option__;
|
||||
DROP TABLE IF EXISTS vn2008.expeditions_pictures__;
|
||||
DROP TABLE IF EXISTS vn2008.scan__;
|
||||
DROP TABLE IF EXISTS vn2008.trolley__;
|
||||
DROP TABLE IF EXISTS vn2008.transport__;
|
||||
DROP TABLE IF EXISTS vn2008.Baldas__;
|
|
@ -0,0 +1,2 @@
|
|||
-- Place your SQL code here
|
||||
ALTER TABLE floranet.`order` ADD IF NOT EXISTS observations TEXT NULL;
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.buy CHANGE containerFk containerFk__ smallint(5) unsigned DEFAULT NULL NULL;
|
|
@ -357,5 +357,6 @@
|
|||
"This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia",
|
||||
"Select ticket or client": "Elija un ticket o un client",
|
||||
"It was not able to create the invoice": "No se pudo crear la factura",
|
||||
"This PDA is already assigned to another user": "This PDA is already assigned to another user"
|
||||
"This PDA is already assigned to another user": "This PDA is already assigned to another user",
|
||||
"ticketCommercial": "El ticket {{ ticket }} para el vendedor {{ salesMan }} está en preparación. (mensaje generado automáticamente)"
|
||||
}
|
|
@ -62,12 +62,12 @@ module.exports = Self => {
|
|||
|
||||
const clone = await models.Roadmap.create(roadmap, options);
|
||||
|
||||
const expeditionTrucks = roadmap.expeditionTruck();
|
||||
expeditionTrucks.map(expeditionTruck => {
|
||||
expeditionTruck.roadmapFk = clone.id;
|
||||
return expeditionTruck;
|
||||
const roadmapStops = roadmap.roadmapStop();
|
||||
roadmapStops.map(roadmapStop => {
|
||||
roadmapStop.roadmapFk = clone.id;
|
||||
return roadmapStop;
|
||||
});
|
||||
await models.ExpeditionTruck.create(expeditionTrucks, options);
|
||||
await models.RoadmapStop.create(roadmapStops, options);
|
||||
}
|
||||
|
||||
await tx.commit();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"DeliveryPoint": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ExpeditionTruck": {
|
||||
"RoadmapStop": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Roadmap": {
|
||||
|
|
|
@ -54,9 +54,9 @@
|
|||
"model": "Supplier",
|
||||
"foreignKey": "supplierFk"
|
||||
},
|
||||
"expeditionTruck": {
|
||||
"roadmapStop": {
|
||||
"type": "hasMany",
|
||||
"model": "ExpeditionTruck",
|
||||
"model": "RoadmapStop",
|
||||
"foreignKey": "roadmapFk"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"name": "ExpeditionTruck",
|
||||
"name": "RoadmapStop",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "expeditionTruck"
|
||||
"table": "roadmapStop"
|
||||
}
|
||||
},
|
||||
"properties": {
|
|
@ -1,22 +1,22 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="ExpeditionTrucks"
|
||||
url="RoadmapStops"
|
||||
where="{roadmapFk: $ctrl.$params.id}"
|
||||
order="eta ASC"
|
||||
data="$ctrl.expeditionTrucks"
|
||||
data="$ctrl.roadmapStops"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.expeditionTrucks"
|
||||
data="$ctrl.roadmapStops"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form class="vn-w-md" name="form" ng-submit="$ctrl.onSubmit()">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal ng-repeat="expeditionTruck in $ctrl.expeditionTrucks">
|
||||
<vn-horizontal ng-repeat="roadmapStop in $ctrl.roadmapStops">
|
||||
<vn-autocomplete vn-one
|
||||
label="Warehouse"
|
||||
ng-model="expeditionTruck.warehouseFk"
|
||||
ng-model="roadmapStop.warehouseFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
|
@ -25,18 +25,18 @@
|
|||
</vn-autocomplete>
|
||||
<vn-date-picker vn-one
|
||||
label="ETA date"
|
||||
ng-model="expeditionTruck.eta"
|
||||
ng-model="roadmapStop.eta"
|
||||
rule>
|
||||
</vn-date-picker>
|
||||
<vn-input-time
|
||||
vn-one
|
||||
label="ETA hour"
|
||||
ng-model="expeditionTruck.eta">
|
||||
ng-model="roadmapStop.eta">
|
||||
</vn-input-time>
|
||||
<vn-textArea
|
||||
vn-one
|
||||
label="Description"
|
||||
ng-model="expeditionTruck.description"
|
||||
ng-model="roadmapStop.description"
|
||||
rule>
|
||||
</vn-textArea>
|
||||
<vn-none>
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
vn-bind="+"
|
||||
vn-tooltip="Add stop"
|
||||
icon="add_circle"
|
||||
vn-click-stop="addExpeditionTruck.show()">
|
||||
vn-click-stop="addRoadmapStop.show()">
|
||||
</vn-icon-button>
|
||||
</a>
|
||||
</h4>
|
||||
|
@ -61,9 +61,9 @@
|
|||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="expeditionTruck in summary.expeditionTruck">
|
||||
<vn-td>{{expeditionTruck.warehouse.name}}</vn-td>
|
||||
<vn-td expand>{{expeditionTruck.eta | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-tr ng-repeat="roadmapStop in summary.roadmapStop">
|
||||
<vn-td>{{roadmapStop.warehouse.name}}</vn-td>
|
||||
<vn-td expand>{{roadmapStop.eta | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
|
@ -75,14 +75,14 @@
|
|||
</vn-supplier-descriptor-popover>
|
||||
|
||||
<vn-dialog
|
||||
vn-id="addExpeditionTruck"
|
||||
vn-id="addRoadmapStop"
|
||||
on-open="$ctrl.getETD()"
|
||||
on-accept="$ctrl.onAddAccept()">
|
||||
<tpl-body>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
label="Warehouse"
|
||||
ng-model="$ctrl.expeditionTruck.warehouseFk"
|
||||
ng-model="$ctrl.roadmapStop.warehouseFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
|
@ -93,18 +93,18 @@
|
|||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
label="ETA date"
|
||||
ng-model="$ctrl.expeditionTruck.eta"
|
||||
ng-model="$ctrl.roadmapStop.eta"
|
||||
rule>
|
||||
</vn-date-picker>
|
||||
<vn-input-time
|
||||
label="ETA hour"
|
||||
ng-model="$ctrl.expeditionTruck.eta">
|
||||
ng-model="$ctrl.roadmapStop.eta">
|
||||
</vn-input-time>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textArea
|
||||
label="Description"
|
||||
ng-model="$ctrl.expeditionTruck.description"
|
||||
ng-model="$ctrl.roadmapStop.description"
|
||||
rule>
|
||||
</vn-textArea>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -20,7 +20,7 @@ class Controller extends Component {
|
|||
include: [
|
||||
{relation: 'supplier'},
|
||||
{relation: 'worker'},
|
||||
{relation: 'expeditionTruck',
|
||||
{relation: 'roadmapStop',
|
||||
scope: {
|
||||
include: [
|
||||
{relation: 'warehouse'}
|
||||
|
@ -36,19 +36,19 @@ class Controller extends Component {
|
|||
const eta = new Date(this.roadmap.etd);
|
||||
eta.setDate(eta.getDate() + 1);
|
||||
|
||||
this.expeditionTruck = {eta: eta};
|
||||
this.roadmapStop = {eta: eta};
|
||||
}
|
||||
|
||||
onAddAccept() {
|
||||
try {
|
||||
const data = {
|
||||
roadmapFk: this.roadmap.id,
|
||||
warehouseFk: this.expeditionTruck.warehouseFk,
|
||||
eta: this.expeditionTruck.eta,
|
||||
description: this.expeditionTruck.description
|
||||
warehouseFk: this.roadmapStop.warehouseFk,
|
||||
eta: this.roadmapStop.eta,
|
||||
description: this.roadmapStop.description
|
||||
};
|
||||
|
||||
this.$http.post(`ExpeditionTrucks`, data)
|
||||
this.$http.post(`RoadmapStops`, data)
|
||||
.then(() => {
|
||||
this.loadData();
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
|
|
|
@ -138,12 +138,10 @@ module.exports = Self => {
|
|||
JOIN alertLevel al ON al.id = ts.alertLevel
|
||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||
JOIN zone z ON z.id = t.zoneFk
|
||||
SET t.routeFk = NULL
|
||||
WHERE DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?)
|
||||
AND al.code NOT IN ('DELIVERED', 'PACKED')
|
||||
AND t.routeFk
|
||||
AND z.name LIKE '%MADRID%'`, [toDate, toDate], {userId: ctx.req.accessToken.userId});
|
||||
AND t.routeFk`, [toDate, toDate], {userId: ctx.req.accessToken.userId});
|
||||
|
||||
return {
|
||||
message: 'Success'
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
}
|
||||
},
|
||||
"relations": {
|
||||
"expeditionTruck": {
|
||||
"roadmapStop": {
|
||||
"type": "belongsTo",
|
||||
"model": "ExpeditionTruck",
|
||||
"model": "RoadmapStop",
|
||||
"foreignKey": "truckFk"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"originFk": {
|
||||
"type": "number"
|
||||
|
|
|
@ -37,18 +37,19 @@ class Controller extends Section {
|
|||
});
|
||||
|
||||
const filter = {
|
||||
fields: ['originFk', 'creationDate', 'newInstance'],
|
||||
fields: ['id', 'originFk', 'creationDate', 'newInstance'],
|
||||
where: {
|
||||
originFk: value,
|
||||
newInstance: {like: '%"isDeleted":true%'}
|
||||
},
|
||||
order: 'creationDate DESC'
|
||||
order: 'creationDate DESC',
|
||||
limit: 1
|
||||
};
|
||||
this.$http.get(`TicketLogs/findOne`, {filter})
|
||||
this.$http.get(`TicketLogs`, {filter})
|
||||
.then(res => {
|
||||
if (res && res.data) {
|
||||
if (res && res.data && res.data.length) {
|
||||
const now = Date.vnNew();
|
||||
const maxDate = new Date(res.data.creationDate);
|
||||
const maxDate = new Date(res.data[0].creationDate);
|
||||
maxDate.setHours(maxDate.getHours() + 1);
|
||||
if (now <= maxDate)
|
||||
return this.canRestoreTicket = true;
|
||||
|
|
|
@ -62,7 +62,23 @@
|
|||
},
|
||||
"isFreelance": {
|
||||
"type" : "boolean"
|
||||
},
|
||||
"fiDueDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"hasMachineryAuthorized": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"seniority": {
|
||||
"type": "date"
|
||||
},
|
||||
"isDisable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isSsDiscounted": {
|
||||
"type": "boolean"
|
||||
}
|
||||
|
||||
},
|
||||
"relations": {
|
||||
"user": {
|
||||
|
|
|
@ -227,7 +227,7 @@ localFixtures:
|
|||
- expeditionScan
|
||||
- expeditionState
|
||||
- expeditionStateType
|
||||
- expeditionTruck
|
||||
- roadmapStop
|
||||
- expense
|
||||
- genus
|
||||
- greuge
|
||||
|
|
Loading…
Reference in New Issue