7983-testToMaster_2438 #2977
|
@ -37,7 +37,6 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
const xmlString = response.data;
|
||||
console.log('xmlString: ', xmlString);
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
||||
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
||||
|
|
|
@ -53,7 +53,7 @@ module.exports = Self => {
|
|||
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
|
||||
LPAD(IF(mw.serviceType IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth, '0') serviceType,
|
||||
IF(mw.weekdays, 'S', 'N') weekDays,
|
||||
oa.description deliveryObservation
|
||||
ta.description deliveryObservation
|
||||
FROM expedition e
|
||||
JOIN ticket t ON e.ticketFk = t.id
|
||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
|
@ -62,8 +62,8 @@ module.exports = Self => {
|
|||
AND mw.weekDays & (1 << WEEKDAY(t.landed))
|
||||
JOIN client c ON t.clientFk = c.id
|
||||
JOIN address a ON t.addressFk = a.id
|
||||
LEFT JOIN addressObservation oa ON oa.addressFk = a.id
|
||||
AND oa.observationTypeFk IN (SELECT id FROM observationType ot WHERE ot.code = 'delivery')
|
||||
LEFT JOIN ticketObservation ta ON ta.ticketFk = t.id
|
||||
AND ta.observationTypeFk IN (SELECT id FROM observationType ot WHERE ot.code = 'agency')
|
||||
JOIN province p ON a.provinceFk = p.id
|
||||
JOIN country co ON co.id = p.countryFk
|
||||
JOIN mrwConfig mc
|
||||
|
|
|
@ -20,9 +20,12 @@ proc:BEGIN
|
|||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemVisible
|
||||
(PRIMARY KEY (item_id))
|
||||
ENGINE = MEMORY
|
||||
SELECT item_id, amount stock, amount visible
|
||||
FROM cache.stock
|
||||
WHERE warehouse_id = v_warehouse;
|
||||
SELECT s.item_id, SUM(s.amount) stock, SUM(s.amount) visible
|
||||
FROM stock s
|
||||
JOIN vn.warehouse w ON w.id = s.warehouse_id
|
||||
WHERE (v_warehouse IS NULL OR s.warehouse_id = v_warehouse)
|
||||
AND w.isComparative
|
||||
GROUP BY s.item_id;
|
||||
|
||||
-- Calculamos los movimientos confirmados de hoy
|
||||
CALL vn.item_calcVisible(NULL, v_warehouse);
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`travel_setDelivered`
|
||||
ON SCHEDULE EVERY 1 DAY
|
||||
STARTS '2024-07-12 00:10:00.000'
|
||||
ON COMPLETION PRESERVE
|
||||
ENABLE
|
||||
DO BEGIN
|
||||
UPDATE travel t
|
||||
SET t.isDelivered = TRUE
|
||||
WHERE t.shipped < util.VN_CURDATE();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -12,6 +12,7 @@ BEGIN
|
|||
DECLARE vInvoiceFk INT;
|
||||
DECLARE vBookEntry INT;
|
||||
DECLARE vFiscalYear INT;
|
||||
DECLARE vIncorrectInvoiceInDueDay INT;
|
||||
|
||||
DECLARE vInvoicesIn CURSOR FOR
|
||||
SELECT DISTINCT e.invoiceInFk
|
||||
|
@ -24,6 +25,19 @@ BEGIN
|
|||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
SELECT GROUP_CONCAT(ii.id) INTO vIncorrectInvoiceInDueDay
|
||||
FROM invoiceInDueDay iidd
|
||||
JOIN invoiceIn ii ON iidd.invoiceInFk = ii.id
|
||||
JOIN `entry` e ON e.invoiceInFk = ii.id
|
||||
JOIN duaEntry de ON de.entryFk = e.id
|
||||
JOIN invoiceInConfig iic
|
||||
WHERE de.duaFk = vDuaFk
|
||||
AND iidd.dueDated <= util.VN_CURDATE() + INTERVAL iic.dueDateMarginDays DAY;
|
||||
|
||||
IF vIncorrectInvoiceInDueDay THEN
|
||||
CALL util.throw(CONCAT('Incorrect due date, invoice: ', vIncorrectInvoiceInDueDay));
|
||||
END IF;
|
||||
|
||||
UPDATE invoiceIn ii
|
||||
JOIN entry e ON e.invoiceInFk = ii.id
|
||||
JOIN duaEntry de ON de.entryFk = e.id
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_calculate`(vInvoiceInFk INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_calculate`(
|
||||
vInvoiceInFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula los vctos. de una factura recibida
|
||||
|
@ -56,12 +58,13 @@ BEGIN
|
|||
COUNT(DISTINCT(pdd.detail)) cont,
|
||||
s.payDay,
|
||||
ii.issued,
|
||||
DATE(ii.created) + INTERVAL 2 DAY created
|
||||
DATE(ii.created) + INTERVAL iic.dueDateMarginDays DAY created
|
||||
FROM invoiceIn ii
|
||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||
LEFT JOIN sage.TiposIva ti ON ti.CodigoIva= iit.taxTypeSageFk
|
||||
JOIN supplier s ON s.id = ii.supplierFk
|
||||
JOIN payDemDetail pdd ON pdd.id = s.payDemFk
|
||||
JOIN payDemDetail pdd ON pdd.id = s.payDemFk
|
||||
JOIN invoiceInConfig iic
|
||||
WHERE ii.id = vInvoiceInFk
|
||||
GROUP BY ii.id
|
||||
)sub
|
||||
|
|
|
@ -21,6 +21,7 @@ BEGIN
|
|||
FROM itemTicketOut i
|
||||
LEFT JOIN ticketState ts ON ts.ticketFk = i.ticketFk
|
||||
JOIN `state` s ON s.id = ts.stateFk
|
||||
JOIN warehouse w ON w.id = i.warehouseFk
|
||||
LEFT JOIN (
|
||||
SELECT DISTINCT st.saleFk
|
||||
FROM saleTracking st
|
||||
|
@ -28,26 +29,31 @@ BEGIN
|
|||
WHERE st.created > vDated
|
||||
AND (s.isPicked OR st.isChecked)
|
||||
) stPrevious ON `stPrevious`.`saleFk` = i.saleFk
|
||||
WHERE IFNULL(vWarehouseFk, i.warehouseFk) = i.warehouseFk
|
||||
WHERE (vWarehouseFk IS NULL OR i.warehouseFk = vWarehouseFk)
|
||||
AND (vSelf IS NULL OR i.itemFk = vSelf)
|
||||
AND (s.isPicked OR i.reserved OR stPrevious.saleFk)
|
||||
AND i.shipped >= vDated AND i.shipped < vTomorrow
|
||||
AND w.isComparative
|
||||
UNION ALL
|
||||
SELECT itemFk, quantity
|
||||
FROM itemEntryIn
|
||||
WHERE isReceived
|
||||
AND landed >= vDated AND landed < vTomorrow
|
||||
AND IFNULL(vWarehouseFk, warehouseInFk) = warehouseInFk
|
||||
AND (vSelf IS NULL OR itemFk = vSelf)
|
||||
AND NOT isVirtualStock
|
||||
SELECT iei.itemFk, iei.quantity
|
||||
FROM itemEntryIn iei
|
||||
JOIN warehouse w ON w.id = iei.warehouseInFk
|
||||
WHERE iei.isReceived
|
||||
AND iei.landed >= vDated AND iei.landed < vTomorrow
|
||||
AND (vWarehouseFk IS NULL OR iei.warehouseInFk = vWarehouseFk)
|
||||
AND (vSelf IS NULL OR iei.itemFk = vSelf)
|
||||
AND NOT iei.isVirtualStock
|
||||
AND w.isComparative
|
||||
UNION ALL
|
||||
SELECT itemFk, quantity
|
||||
FROM itemEntryOut
|
||||
WHERE isDelivered
|
||||
AND shipped >= vDated
|
||||
AND shipped < vTomorrow
|
||||
AND IFNULL(vWarehouseFk, warehouseOutFk) = warehouseOutFk
|
||||
AND (vSelf IS NULL OR itemFk = vSelf)
|
||||
SELECT ieo.itemFk, ieo.quantity
|
||||
FROM itemEntryOut ieo
|
||||
JOIN warehouse w ON w.id = ieo.warehouseOutFk
|
||||
WHERE ieo.isDelivered
|
||||
AND ieo.shipped >= vDated
|
||||
AND ieo.shipped < vTomorrow
|
||||
AND (vWarehouseFk IS NULL OR ieo.warehouseOutFk = vWarehouseFk)
|
||||
AND (vSelf IS NULL OR ieo.itemFk = vSelf)
|
||||
AND w.isComparative
|
||||
) t
|
||||
GROUP BY itemFk
|
||||
ON DUPLICATE KEY UPDATE
|
||||
|
|
|
@ -75,13 +75,6 @@ proc: BEGIN
|
|||
) sub
|
||||
GROUP BY itemFk;
|
||||
|
||||
UPDATE tmp.itemInventory ai
|
||||
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
|
||||
SET ai.inventory = iic.quantity,
|
||||
ai.visible = iic.quantity,
|
||||
ai.avalaible = iic.quantity,
|
||||
ai.sd = iic.quantity;
|
||||
|
||||
-- Cálculo del visible
|
||||
CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
|
||||
|
||||
|
@ -93,8 +86,12 @@ proc: BEGIN
|
|||
WHERE calc_id = vCalcFk;
|
||||
|
||||
UPDATE tmp.itemInventory it
|
||||
JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id
|
||||
SET it.visible = it.visible + ivc.visible;
|
||||
LEFT JOIN tItemInventoryCalc iic ON iic.itemFk = it.id
|
||||
LEFT JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id
|
||||
SET it.inventory = iic.quantity,
|
||||
it.visible = ivc.visible,
|
||||
it.avalaible = iic.quantity,
|
||||
it.sd = iic.quantity;
|
||||
|
||||
-- Calculo del disponible
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
||||
|
@ -142,31 +139,35 @@ proc: BEGIN
|
|||
CALL item_getAtp(vDate);
|
||||
CALL travel_upcomingArrivals(vWarehouseFk, vDate);
|
||||
|
||||
UPDATE tmp.itemInventory ai
|
||||
JOIN (
|
||||
SELECT it.itemFk,
|
||||
SUM(it.quantity) quantity,
|
||||
im.quantity minQuantity
|
||||
FROM tmp.itemCalc it
|
||||
JOIN tmp.itemAtp im ON im.itemFk = it.itemFk
|
||||
JOIN item i ON i.id = it.itemFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
LEFT JOIN tmp.itemTravel t ON t.wh = o.warehouseFk
|
||||
WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL,
|
||||
t.landing,
|
||||
vDateToTomorrow)
|
||||
GROUP BY it.itemFk
|
||||
) sub ON sub.itemFk = ai.id
|
||||
SET ai.avalaible = IF(sub.minQuantity > 0,
|
||||
ai.avalaible,
|
||||
ai.avalaible + sub.minQuantity),
|
||||
ai.sd = ai.inventory + sub.quantity;
|
||||
CREATE OR REPLACE TEMPORARY TABLE tItemAvailableCalc
|
||||
(PRIMARY KEY (itemFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT it.itemFk,
|
||||
SUM(it.quantity) quantity,
|
||||
im.quantity minQuantity
|
||||
FROM tmp.itemCalc it
|
||||
JOIN tmp.itemAtp im ON im.itemFk = it.itemFk
|
||||
JOIN item i ON i.id = it.itemFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
LEFT JOIN tmp.itemTravel t ON t.wh = o.warehouseFk
|
||||
WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL,
|
||||
t.landing,
|
||||
vDateToTomorrow)
|
||||
GROUP BY it.itemFk;
|
||||
|
||||
UPDATE tmp.itemInventory it
|
||||
JOIN tItemAvailableCalc iac ON iac.itemFk = it.id
|
||||
SET it.avalaible = IF(iac.minQuantity > 0,
|
||||
it.avalaible,
|
||||
it.avalaible + iac.minQuantity),
|
||||
it.sd = it.inventory + iac.quantity;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.itemTravel,
|
||||
tmp.itemCalc,
|
||||
tmp.itemAtp,
|
||||
tItemInventoryCalc,
|
||||
tItemVisibleCalc;
|
||||
tItemVisibleCalc,
|
||||
tItemAvailableCalc;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -174,27 +174,30 @@ proc: BEGIN
|
|||
WHERE NOT `lines`;
|
||||
|
||||
-- Lineas por linea de encajado
|
||||
CREATE OR REPLACE TEMPORARY TABLE tItemPackingType
|
||||
(PRIMARY KEY(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT ticketFk,
|
||||
SUM(sub.H) H,
|
||||
SUM(sub.V) V,
|
||||
SUM(sub.N) N
|
||||
FROM (
|
||||
SELECT t.ticketFk,
|
||||
SUM(i.itemPackingTypeFk = 'H') H,
|
||||
SUM(i.itemPackingTypeFk = 'V') V,
|
||||
SUM(i.itemPackingTypeFk IS NULL) N
|
||||
FROM tmp.productionTicket t
|
||||
JOIN sale s ON s.ticketFk = t.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
GROUP BY t.ticketFk, i.itemPackingTypeFk
|
||||
) sub
|
||||
GROUP BY ticketFk;
|
||||
|
||||
UPDATE tmp.productionBuffer pb
|
||||
JOIN (
|
||||
SELECT ticketFk,
|
||||
SUM(sub.H) H,
|
||||
SUM(sub.V) V,
|
||||
SUM(sub.N) N
|
||||
FROM (
|
||||
SELECT t.ticketFk,
|
||||
SUM(i.itemPackingTypeFk = 'H') H,
|
||||
SUM(i.itemPackingTypeFk = 'V') V,
|
||||
SUM(i.itemPackingTypeFk IS NULL) N
|
||||
FROM tmp.productionTicket t
|
||||
JOIN sale s ON s.ticketFk = t.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
GROUP BY t.ticketFk, i.itemPackingTypeFk
|
||||
) sub
|
||||
GROUP BY ticketFk
|
||||
) sub2 ON sub2.ticketFk = pb.ticketFk
|
||||
SET pb.H = sub2.H,
|
||||
pb.V = sub2.V,
|
||||
pb.N = sub2.N;
|
||||
JOIN tItemPackingType ti ON ti.ticketFk = pb.ticketFk
|
||||
SET pb.H = ti.H,
|
||||
pb.V = ti.V,
|
||||
pb.N = ti.N;
|
||||
|
||||
-- Colecciones segun tipo de encajado
|
||||
UPDATE tmp.productionBuffer pb
|
||||
|
@ -273,6 +276,7 @@ proc: BEGIN
|
|||
tmp.risk,
|
||||
tmp.ticket_problems,
|
||||
tmp.ticketWithPrevia,
|
||||
tItemShelvingStock;
|
||||
tItemShelvingStock,
|
||||
tItemPackingType;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_splitItemPackingType`(
|
||||
vSelf INT,
|
||||
vItemPackingTypeFk VARCHAR(1)
|
||||
vOriginalItemPackingTypeFk VARCHAR(1)
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ BEGIN
|
|||
* Respeta el id inicial para el tipo propuesto.
|
||||
*
|
||||
* @param vSelf Id ticket
|
||||
* @param vItemPackingTypeFk Tipo para el que se reserva el número de ticket original
|
||||
* @param vOriginalItemPackingTypeFk Tipo para el que se reserva el número de ticket original
|
||||
* @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||
*/
|
||||
DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H';
|
||||
|
@ -23,7 +23,7 @@ BEGIN
|
|||
SELECT itemPackingTypeFk
|
||||
FROM tSaleGroup
|
||||
WHERE itemPackingTypeFk IS NOT NULL
|
||||
ORDER BY (itemPackingTypeFk = vItemPackingTypeFk) DESC;
|
||||
ORDER BY (itemPackingTypeFk = vOriginalItemPackingTypeFk) DESC;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.invoiceInConfig
|
||||
ADD dueDateMarginDays INT UNSIGNED DEFAULT 2 NULL;
|
|
@ -4,7 +4,17 @@ import getMainRoute from 'core/lib/get-main-route';
|
|||
config.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function config($stateProvider, $urlRouterProvider) {
|
||||
$urlRouterProvider
|
||||
.otherwise('/');
|
||||
.otherwise(async($injector, {$location}) => {
|
||||
const prefix = '#!';
|
||||
if (!$location.$$path) return window.location.href = `/${prefix}/`;
|
||||
|
||||
const url = $location.$$absUrl
|
||||
.replace('5000', '9000')
|
||||
.replace('salix', 'lilium')
|
||||
.replace(prefix, '#')
|
||||
.replace('client', 'customer');
|
||||
window.location.href = url;
|
||||
});
|
||||
|
||||
$stateProvider
|
||||
.state('layout', {
|
||||
|
|
|
@ -85,6 +85,7 @@ module.exports = Self => {
|
|||
LEFT JOIN (
|
||||
SELECT MAX(started), clientFk, finished
|
||||
FROM recovery
|
||||
GROUP BY clientFk
|
||||
) r ON r.clientFk = c.id
|
||||
LEFT JOIN workerDepartment wd ON wd.workerFk = u.id
|
||||
JOIN department dp ON dp.id = wd.departmentFk
|
||||
|
|
Loading…
Reference in New Issue