Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6861-Pasar-modo-trabajo-de-previa-a-reservas
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-04-12 09:49:18 +02:00
commit 13415b1ef0
48 changed files with 620 additions and 305 deletions

View File

@ -45,7 +45,6 @@ module.exports = Self => {
});
availableNotificationsMap.delete(active.notificationFk);
}
return {
active: [...activeNotificationsMap.entries()],
available: [...availableNotificationsMap.entries()]

View File

@ -4,8 +4,8 @@ describe('NotificationSubscription getList()', () => {
it('should return a list of available and active notifications of a user', async() => {
const userId = 9;
const {active, available} = await models.NotificationSubscription.getList(userId);
const notifications = await models.Notification.find({});
const totalAvailable = notifications.length - active.length;
const notifications = await models.NotificationSubscription.getAvailable(userId);
const totalAvailable = notifications.size - active.length;
expect(active.length).toEqual(3);
expect(available.length).toEqual(totalAvailable);

View File

@ -174,5 +174,8 @@
},
"WorkerActivityType": {
"dataSource": "vn"
},
"ProductionConfig": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,19 @@
{
"name": "ProductionConfig",
"base": "VnModel",
"options": {
"mysql": {
"table": "productionConfig"
}
},
"properties": {
"id": {
"type": "number",
"required": true,
"id": true
},
"backupPrinterNotificationDelay": {
"type": "string"
}
}
}

View File

@ -41,8 +41,7 @@ describe('loopback model NotificationSubscription', () => {
try {
const options = {transaction: tx, accessToken: {userId: 9}};
const notificationSubscriptionId = 2;
await models.NotificationSubscription.destroyAll({id: notificationSubscriptionId}, options);
await models.NotificationSubscription.destroyAll({id: 2}, options);
await tx.rollback();
} catch (e) {
@ -76,8 +75,7 @@ describe('loopback model NotificationSubscription', () => {
try {
const options = {transaction: tx, accessToken: {userId: 9}};
const notificationSubscriptionId = 6;
await models.NotificationSubscription.destroyAll({id: notificationSubscriptionId}, options);
await models.NotificationSubscription.destroyAll({id: 6}, options);
await tx.rollback();
} catch (e) {
@ -111,8 +109,7 @@ describe('loopback model NotificationSubscription', () => {
try {
const options = {transaction: tx, accessToken: {userId: 19}};
const notificationSubscriptionId = 4;
await models.NotificationSubscription.destroyAll({id: notificationSubscriptionId}, options);
await models.NotificationSubscription.destroyAll({id: 4}, options);
await tx.rollback();
} catch (e) {

View File

@ -113,9 +113,6 @@ INSERT INTO vn.ticket (clientFk, warehouseFk, shipped, nickname, refFk, addressF
(100, 4, '2022-07-12 00:00:00', 'root', NULL, 195, NULL, NULL, 0, 0, 0, 0, NULL, 0, '2022-07-12 16:18:58', 1, NULL, 4, NULL, 1, 567, 1, '2022-07-12', 0, 0, 6, NULL, NULL, NULL, NULL, NULL),
(100, 5, '2022-07-12 00:00:00', 'root', NULL, 195, NULL, NULL, 0, 0, 0, 0, NULL, 0, '2022-07-12 16:18:58', 1, NULL, 5, NULL, 1, 567, 1, '2022-07-12', 0, 0, 1, NULL, NULL, NULL, NULL, NULL);
*/
INSERT INTO vn.sector (description,warehouseFk) VALUES
('Sector One',1);
INSERT INTO vn.saleGroup (userFk,parkingFk,sectorFk) VALUES
(100,1,1);
@ -156,16 +153,6 @@ INSERT INTO `vn`.`occupationCode` (`code`, `name`)
('b', 'Representantes de comercio'),
('c', 'Personal de oficios en trabajos de construcción en general, y en instalac.,edificios y obras');
INSERT INTO `vn2008`.`payroll_employee` (`CodTrabajador`,`codempresa`)
VALUES
(36,20),
(43,20),
(76,20),
(1106,20),
(1107,20),
(1108,20),
(1109,20),
(1110,20);
INSERT INTO `vn`.`trainingCourseType` (`id`, `name`)
VALUES

View File

@ -198,7 +198,7 @@ INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`, `sectorFk`, `ipAd
(2, 'printer2', 'path2', 1, 1 , NULL),
(4, 'printer4', 'path4', 0, NULL, '10.1.10.4');
UPDATE `vn`.`sector` SET mainPrinterFk = 1 WHERE id = 1;
UPDATE `vn`.`sector` SET `backupPrinterFk` = 1 WHERE id = 1;
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`,`bossFk`, `phone`)
@ -1973,6 +1973,15 @@ INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxC
(4, 'Documentos', 1, 2.00, 1, 9, 1),
(5, 'Documentos', 1, 2.00, 1, 8, 1);
INSERT INTO `pbx`.`config` (id,defaultPrefix)
VALUES (1,'0034');
INSERT INTO `pbx`.`prefix` (country, prefix)
VALUES
('es', '0034'),
('fr', '0033'),
('pt', '00351');
INSERT INTO `pbx`.`sip`(`user_id`, `extension`)
VALUES
(1, 1010),
@ -2813,7 +2822,8 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`)
(4, 'supplier-pay-method-update', 'A supplier pay method has been updated'),
(5, 'modified-entry', 'An entry has been modified'),
(6, 'book-entry-deleted', 'accounting entries deleted'),
(7, 'zone-included','An email to notify zoneCollisions');
(7, 'zone-included','An email to notify zoneCollisions'),
(8, 'backup-printer-selected','A backup printer has been selected');
TRUNCATE `util`.`notificationAcl`;
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
@ -2825,7 +2835,8 @@ INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
(4, 1),
(5, 9),
(6, 9),
(7, 9);
(7, 9),
(8, 66);
TRUNCATE `util`.`notificationQueue`;
INSERT INTO `util`.`notificationQueue` (`id`, `notificationFk`, `params`, `authorFk`, `status`, `created`)
@ -2845,15 +2856,16 @@ INSERT INTO `util`.`notificationSubscription` (`notificationFk`, `userFk`)
(1, 9),
(1, 3),
(6, 9),
(7, 9);
(7, 9),
(8, 66);
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
VALUES
(1, 9);
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`)
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`, `backupPrinterNotificationDelay`)
VALUES
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6);
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6, 3600);
INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`)
VALUES
@ -3734,8 +3746,7 @@ INSERT INTO vn.ticketLog (originFk,userFk,`action`,creationDate,changedModel,new
VALUES (18,9,'insert','2001-01-01 11:01:00.000','Ticket','{"isDeleted":true}',45,'Super Man');
INSERT INTO `vn`.`supplierDms`(`supplierFk`, `dmsFk`, `editorFk`)
VALUES
(1, 10, 9);
VALUES (1, 10, 9);
INSERT INTO `vn`.`accountReconciliation` (supplierAccountFk,operationDated,valueDated,amount,concept,debitCredit,calculatedCode,created)
VALUES
@ -3749,5 +3760,4 @@ INSERT INTO `vn`.`accountReconciliation` (supplierAccountFk,operationDated,value
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',6513.7,'RCBO.ENERPLUS','debit','120','2023-12-14 08:39:53.000');
INSERT INTO `vn`.`accountReconciliationConfig`(currencyFk, warehouseFk)
VALUES
(1, 1);
VALUES (1, 1);

View File

@ -0,0 +1,64 @@
DROP PROCEDURE IF EXISTS floranet.catalogue_get;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE floranet.catalogue_get(vLanded DATE, vPostalCode VARCHAR(15))
READS SQL DATA
proc:BEGIN
/**
* Returns list, price and all the stuff regarding the floranet items.
*
* @param vLanded Delivery date
* @param vPostalCode Delivery address postal code
*/
DECLARE vLastCatalogueFk INT;
DECLARE vLockName VARCHAR(20);
DECLARE vLockTime INT;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
DO RELEASE_LOCK(vLockName);
RESIGNAL;
END;
SET vLockName = 'catalogue_get';
SET vLockTime = 15;
IF NOT GET_LOCK(vLockName, vLockTime) THEN
LEAVE proc;
END IF;
SELECT MAX(id) INTO vLastCatalogueFk
FROM catalogue;
INSERT INTO catalogue(
name,
price,
itemFk,
dated,
postalCode,
`type`,
image,
description
)
SELECT i.name,
i.`size`,
i.id,
vLanded,
vPostalCode,
it.name,
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image),
i.description
FROM vn.item i
JOIN vn.itemType it ON it.id = i.typeFk
WHERE it.code IN ('FNR','FNP');
SELECT *
FROM catalogue
WHERE id > IFNULL(vLastCatalogueFk,0);
DO RELEASE_LOCK(vLockName);
END$$
DELIMITER ;

View File

@ -0,0 +1,20 @@
DROP PROCEDURE IF EXISTS floranet.contact_request;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost`
PROCEDURE floranet.contact_request(
vName VARCHAR(100),
vPhone VARCHAR(15),
vEmail VARCHAR(100),
vMessage TEXT)
READS SQL DATA
BEGIN
/**
* Set actions for contact request
*
* @param vPostalCode Delivery address postal code
*/
END$$
DELIMITER ;

View File

@ -0,0 +1,29 @@
DROP PROCEDURE IF EXISTS floranet.deliveryDate_get;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `floranet`.`deliveryDate_get`(vPostalCode VARCHAR(15))
READS SQL DATA
BEGIN
/**
* Returns available dates for this postalCode, in the next seven days.
*
* @param vPostalCode Delivery address postal code
*/
DECLARE vCurrentDayOfWeek INT;
SET vCurrentDayOfWeek = DAYOFWEEK(NOW());
SELECT DISTINCT nextDay
FROM (
SELECT CURDATE() + INTERVAL IF(
apc.dayOfWeek >= vCurrentDayOfWeek,
apc.dayOfWeek - vCurrentDayOfWeek,
7 - apc.dayOfWeek
) DAY nextDay,
NOW() + INTERVAL apc.hoursInAdvance - 12 HOUR minDeliveryTime
FROM addressPostCode apc
WHERE apc.postCode = vPostalCode
HAVING nextDay > minDeliveryTime) sub;
END$$
DELIMITER ;

View File

@ -0,0 +1,25 @@
DROP PROCEDURE IF EXISTS floranet.order_confirm;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost`PROCEDURE floranet.order_confirm(vCatalogueFk INT)
READS SQL DATA
BEGIN
/** Update order.isPaid field.
*
* @param vCatalogueFk floranet.catalogue.id
*
* @returns floranet.order.isPaid
*/
UPDATE `order`
SET isPaid = TRUE,
payed = NOW()
WHERE catalogueFk = vCatalogueFk;
SELECT isPaid
FROM `order`
WHERE catalogueFk = vCatalogueFk;
END$$
DELIMITER ;

View File

@ -0,0 +1,42 @@
DROP PROCEDURE IF EXISTS floranet.order_put;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE floranet.order_put(vOrder JSON)
READS SQL DATA
BEGIN
/**
* Get and process an order.
*
* @param vOrder Data of the order
*
* Customer data: <customerName>, <email>, <customerPhone>
*
* Item data: <catalogueFk>, <message>
*
* Delivery data: <deliveryName>, <address>, <deliveryPhone>
*
*/
INSERT IGNORE INTO `order`(
catalogueFk,
customerName,
email,
customerPhone,
message,
deliveryName,
address,
deliveryPhone
)
VALUES (JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.catalogueFk')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.customerName')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.email')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.customerPhone')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.message')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.deliveryName')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.address')),
JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.deliveryPhone'))
);
SELECT LAST_INSERT_ID() orderFk;
END$$
DELIMITER ;

View File

@ -0,0 +1,20 @@
DROP PROCEDURE IF EXISTS floranet.sliders_get;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE floranet.sliders_get()
READS SQL DATA
BEGIN
/**
* Returns list of url for sliders.
*/
SELECT
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image) url,
i.longName
FROM vn.item i
JOIN vn.itemType it ON it.id = i.typeFk
WHERE it.code IN ('FNR','FNP')
LIMIT 3;
END$$
DELIMITER ;

View File

@ -0,0 +1,35 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_getRisk`(
vDate DATE
)
BEGIN
/**
* Retorna el riesgo de los clientes activos.
*
* @param vDate Fecha a calcular
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.clientGetDebt
(PRIMARY KEY (clientFk))
ENGINE = MEMORY
SELECT id clientFk
FROM client
WHERE isActive;
CALL client_getDebt(vDate);
SELECT c.socialName,
r.clientFk,
c.credit,
CAST(r.risk AS DECIMAL (10,2)) risk,
CAST(c.credit - r.risk AS DECIMAL (10,2)) difference,
co.country
FROM client c
JOIN tmp.risk r ON r.clientFk = c.id
JOIN country co ON co.id = c.countryFk
GROUP BY c.id;
DROP TEMPORARY TABLE
tmp.risk,
tmp.clientGetDebt;
END$$
DELIMITER ;

View File

@ -1,42 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`creditInsurance_getRisk`()
BEGIN
/**
* Devuelve el riesgo de los clientes que estan asegurados
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.client_list
(PRIMARY KEY (Id_Cliente))
ENGINE = MEMORY
SELECT * FROM (
SELECT cc.client Id_Cliente, ci.grade
FROM creditClassification cc
JOIN creditInsurance ci ON cc.id = ci.creditClassification
WHERE dateEnd IS NULL
ORDER BY ci.creationDate DESC
LIMIT 10000000000000000000) t1
GROUP BY Id_Cliente;
CALL vn2008.risk_vs_client_list(util.VN_CURDATE());
SELECT
c.id,
c.name,
c.credit clientCredit,
c.creditInsurance solunion,
CAST(r.risk AS DECIMAL(10,0)) risk,
CAST(c.creditInsurance - r.risk AS DECIMAL(10,0)) riskAlive,
cac.invoiced billedAnnually,
c.dueDay,
ci.grade,
c2.country
FROM tmp.client_list ci
LEFT JOIN tmp.risk r ON r.Id_Cliente = ci.Id_Cliente
JOIN client c ON c.id = ci.Id_Cliente
JOIN bs.clientAnnualConsumption cac ON c.id = cac.clientFk
JOIN country c2 ON c2.id = c.countryFk
GROUP BY c.id;
DROP TEMPORARY TABLE IF EXISTS tmp.risk;
DROP TEMPORARY TABLE IF EXISTS tmp.client_list;
END$$
DELIMITER ;

View File

@ -232,8 +232,6 @@ BEGIN
CLOSE cWarehouses;
UPDATE config SET inventoried = vInventoryDate;
SET @isModeInventory := FALSE;
CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete
(INDEX(entryId)) ENGINE = MEMORY
@ -262,6 +260,8 @@ BEGIN
FROM travel t
JOIN tEntryToDelete tmp ON tmp.travelId = t.id;
SET @isModeInventory := FALSE;
DROP TEMPORARY TABLE IF EXISTS tEntryToDelete;
COMMIT;

View File

@ -1,29 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`riskAllClients`(maxRiskDate DATE)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.client_list;
CREATE TEMPORARY TABLE tmp.client_list
(PRIMARY KEY (Id_Cliente))
ENGINE = MEMORY
SELECT id Id_Cliente, null grade FROM vn.client;
CALL vn2008.risk_vs_client_list(maxRiskDate);
SELECT
c.RazonSocial,
c.Id_Cliente,
c.Credito,
CAST(r.risk as DECIMAL (10,2)) risk,
CAST(c.Credito - r.risk as DECIMAL (10,2)) Diferencia,
c.Id_Pais
FROM
vn2008.Clientes c
JOIN tmp.risk r ON r.Id_Cliente = c.Id_Cliente
JOIN tmp.client_list ci ON c.Id_Cliente = ci.Id_Cliente
GROUP BY c.Id_cliente;
DROP TEMPORARY TABLE IF EXISTS tmp.risk;
DROP TEMPORARY TABLE IF EXISTS tmp.client_list;
END$$
DELIMITER ;

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_doCmr`(vSelf INT)
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_doCmr`(vSelf INT)
BEGIN
/**
* Crea u actualiza la información del CMR asociado con
@ -29,7 +29,6 @@ BEGIN
JOIN province p ON p.id = a.provinceFk
JOIN country co ON co.id = p.countryFk
JOIN agencyMode am ON am.id = t.agencyModeFk
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
JOIN warehouse w ON w.id = t.warehouseFk
JOIN company com ON com.id = t.companyFk
JOIN client c2 ON c2.id = com.clientFk
@ -38,12 +37,10 @@ BEGIN
LEFT JOIN route r ON r.id = t.routeFk
LEFT JOIN worker wo ON wo.id = r.workerFk
LEFT JOIN vehicle v ON v.id = r.vehicleFk
WHERE t.shipped BETWEEN util.yesterday() AND util.dayEnd(util.VN_CURDATE())
AND al.code IN ('PACKED', 'DELIVERED')
WHERE al.code IN ('PACKED', 'DELIVERED')
AND co.code <> 'ES'
AND am.name <> 'ABONO'
AND w.code = 'ALG'
AND dm.code = 'DELIVERY'
AND t.id = vSelf
GROUP BY t.id;
@ -85,5 +82,5 @@ BEGIN
COMMIT;
DROP TEMPORARY TABLE tTicket;
END$$
DELIMITER ;
END$$
DELIMITER ;

View File

@ -1,84 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`risk_vs_client_list`(maxRiskDate DATE)
BEGIN
/**
* Calcula el riesgo para los clientes activos de la tabla temporal tmp.client_list
*
* @deprecated usar vn.client_getDebt
* @param maxRiskDate Fecha maxima de los registros
* @return table tmp.risk
*/
DECLARE startingDate DATETIME DEFAULT TIMESTAMPADD(DAY, - DAYOFMONTH(util.VN_CURDATE()) - 60, util.VN_CURDATE());
DECLARE endingDate DATETIME;
DECLARE MAX_RISK_ALLOWED INT DEFAULT 200;
SET maxRiskDate = IFNULL(maxRiskDate, util.VN_CURDATE());
SET endingDate = TIMESTAMP(maxRiskDate, '23:59:59');
DROP TEMPORARY TABLE IF EXISTS tmp.client_list_2;
CREATE TEMPORARY TABLE tmp.client_list_2
(PRIMARY KEY (Id_Cliente))
ENGINE = MEMORY
SELECT *
FROM tmp.client_list;
DROP TEMPORARY TABLE IF EXISTS tmp.client_list_3;
CREATE TEMPORARY TABLE tmp.client_list_3
(PRIMARY KEY (Id_Cliente))
ENGINE = MEMORY
SELECT *
FROM tmp.client_list;
DROP TEMPORARY TABLE IF EXISTS tmp.tickets_sin_facturar;
CREATE TEMPORARY TABLE tmp.tickets_sin_facturar
(PRIMARY KEY (Id_Cliente))
ENGINE = MEMORY
SELECT t.Id_Cliente, floor(IF(cl.isVies, 1, 1.1) * sum(Cantidad * Preu * (100 - Descuento) / 100)) as total
FROM Movimientos m
JOIN Tickets t on m.Id_Ticket = t.Id_Ticket
JOIN tmp.client_list c on c.Id_Cliente = t.Id_Cliente
JOIN vn.client cl ON cl.id = t.Id_Cliente
WHERE Factura IS NULL
AND Fecha BETWEEN startingDate AND endingDate
GROUP BY t.Id_Cliente;
DROP TEMPORARY TABLE IF EXISTS tmp.risk;
CREATE TEMPORARY TABLE tmp.risk
(PRIMARY KEY (Id_Cliente))
ENGINE = MEMORY
SELECT Id_Cliente, SUM(amount) risk, sum(saldo) saldo
FROM Clientes c
JOIN (
SELECT clientFk, SUM(amount) amount,SUM(amount) saldo
FROM vn.clientRisk
JOIN tmp.client_list on Id_Cliente = clientFk
GROUP BY clientFk
UNION ALL
SELECT Id_Cliente, SUM(Entregado),SUM(Entregado)
FROM Recibos
JOIN tmp.client_list_2 using(Id_Cliente)
WHERE Fechacobro > endingDate
GROUP BY Id_Cliente
UNION ALL
SELECT Id_Cliente, total,0
FROM tmp.tickets_sin_facturar
UNION ALL
SELECT t.clientFk, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)), CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2))
FROM hedera.tpvTransaction t
JOIN tmp.client_list_3 on Id_Cliente = t.clientFk
WHERE t.receiptFk IS NULL
AND t.status = 'ok'
GROUP BY t.clientFk
) t ON c.Id_Cliente = t.clientFk
WHERE c.activo != FALSE
GROUP BY c.Id_Cliente;
DELETE r.*
FROM tmp.risk r
JOIN vn2008.Clientes c on c.Id_Cliente = r.Id_Cliente
JOIN vn2008.pay_met pm on pm.id = c.pay_met_id
WHERE IFNULL(r.saldo,0) < 10
AND r.risk <= MAX_RISK_ALLOWED
AND pm.`name` = 'TARJETA';
END$$
DELIMITER ;

View File

@ -0,0 +1,11 @@
ALTER TABLE `vn`.`packingSite` DROP FOREIGN KEY IF EXISTS `packingSite_FK_4`;
ALTER TABLE `vn`.`arcRead` DROP FOREIGN KEY IF EXISTS `worker_printer_FK`;
ALTER TABLE `vn`.`host` DROP FOREIGN KEY IF EXISTS `configHost_FK`;
ALTER TABLE `vn`.`operator` DROP FOREIGN KEY IF EXISTS `operator_FK_5`;
ALTER TABLE `vn`.`packingSite` DROP FOREIGN KEY IF EXISTS `packingSite_FK_1`;
ALTER TABLE `vn`.`printQueue` DROP FOREIGN KEY IF EXISTS `printQueue_printerFk`;
ALTER TABLE `vn`.`sector` DROP FOREIGN KEY IF EXISTS `sector_FK_1`;
ALTER TABLE `vn`.`worker` DROP FOREIGN KEY IF EXISTS `worker_FK`;
ALTER TABLE dipole.printer DROP FOREIGN KEY IF EXISTS printer_FK;
ALTER TABLE dipole.expedition_PrintOut DROP FOREIGN KEY IF EXISTS expedition_PrintOut_FK;

View File

@ -0,0 +1,28 @@
ALTER TABLE `vn`.`printer` MODIFY COLUMN IF EXISTS `id` int unsigned auto_increment NOT NULL;
ALTER TABLE `vn`.`arcRead` MODIFY COLUMN IF EXISTS `printerFk` int unsigned DEFAULT NULL NULL;
ALTER TABLE `vn`.`arcRead` ADD CONSTRAINT `arcRead_FK` FOREIGN KEY IF NOT EXISTS (printerFk) REFERENCES vn.printer(id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `vn`.`host` MODIFY COLUMN IF EXISTS `printerFk` int unsigned DEFAULT NULL NULL;
ALTER TABLE `vn`.`host` ADD CONSTRAINT `host_FK` FOREIGN KEY IF NOT EXISTS (printerFk) REFERENCES vn.printer(id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE `vn`.`operator` MODIFY COLUMN IF EXISTS `labelerFk` int unsigned DEFAULT NULL NULL;
ALTER TABLE `vn`.`operator` ADD CONSTRAINT `operator_FK_4` FOREIGN KEY IF NOT EXISTS (labelerFk) REFERENCES vn.printer(id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `vn`.`packingSite` MODIFY COLUMN IF EXISTS `printerFk` int unsigned DEFAULT NULL NULL;
ALTER TABLE `vn`.`packingSite` ADD CONSTRAINT `packingSite_FK_1` FOREIGN KEY IF NOT EXISTS (printerFk) REFERENCES vn.printer(id) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `vn`.`packingSite` MODIFY COLUMN IF EXISTS `printerRfidFk` int unsigned DEFAULT NULL NULL;
ALTER TABLE `vn`.`packingSite` ADD CONSTRAINT `packingSite_FK_4` FOREIGN KEY IF NOT EXISTS(printerRfidFk) REFERENCES vn.printer(id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE `vn`.`printQueue` MODIFY COLUMN IF EXISTS `printerFk` int unsigned DEFAULT NULL NULL;
ALTER TABLE `vn`.`printQueue` ADD CONSTRAINT `printQueue_FK` FOREIGN KEY IF NOT EXISTS (id) REFERENCES vn.printer(id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE `vn`.`sector` MODIFY COLUMN IF EXISTS `mainPrinterFk` int unsigned DEFAULT NULL NULL;
ALTER TABLE `vn`.`sector` ADD CONSTRAINT `sector_FK` FOREIGN KEY IF NOT EXISTS (mainPrinterFk) REFERENCES vn.printer(id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `dipole`.`printer` MODIFY COLUMN IF EXISTS `id` int unsigned DEFAULT NULL NULL;
ALTER TABLE `dipole`.`printer` ADD CONSTRAINT `vnPrinter_FK` FOREIGN KEY IF NOT EXISTS (id) REFERENCES vn.printer(id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `dipole`.`expedition_PrintOut` MODIFY COLUMN IF EXISTS `printerFk` int unsigned DEFAULT 0 NOT NULL;
ALTER TABLE `dipole`.`expedition_PrintOut` ADD CONSTRAINT `expedition_PrintOut_FK` FOREIGN KEY IF NOT EXISTS (printerFk) REFERENCES printer(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,17 @@
ALTER TABLE `vn`.`productionConfig` ADD IF NOT EXISTS backupPrinterNotificationDelay int unsigned NULL
COMMENT 'Minimum seconds Interval to Prevent Spam from Same-Type Notifications';
ALTER TABLE vn.sector DROP FOREIGN KEY IF EXISTS sector_FK;
ALTER TABLE `vn`.`sector` CHANGE IF EXISTS `mainPrinterFk` `backupPrinterFk` int unsigned DEFAULT NULL NULL;
ALTER TABLE `util`.`notificationSubscription` DROP FOREIGN KEY IF EXISTS `notificationSubscription_ibfk_1`;
ALTER TABLE `util`.`notificationQueue` DROP FOREIGN KEY IF EXISTS `nnotificationQueue_ibfk_1`;
ALTER TABLE `util`.`notificationAcl` DROP FOREIGN KEY IF EXISTS `notificationAcl_ibfk_1`;
ALTER TABLE `util`.`notification` MODIFY COLUMN IF EXISTS `id` int(11) auto_increment NOT NULL;
ALTER TABLE `util`.`notificationSubscription` ADD CONSTRAINT `notificationSubscription_Fk` FOREIGN KEY IF NOT EXISTS (`notificationFk`) REFERENCES `util`.`notification`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `util`.`notificationQueue` ADD CONSTRAINT `notificationQueue_Fk` FOREIGN KEY IF NOT EXISTS (`notificationFk`) REFERENCES `util`.`notification`(`name`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `util`.`notificationAcl` ADD CONSTRAINT `notificationAcl_Fk` FOREIGN KEY IF NOT EXISTS (`notificationFk`) REFERENCES `util`.`notification`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,12 @@
INSERT IGNORE INTO util.notification (name, description)
VALUES ('backup-printer-selected','A backup printer has been selected');
INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk)
SELECT id, 10435
FROM util.notification
WHERE name = 'backup-printer-selected';
INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk)
SELECT id, 66
FROM util.notification
WHERE name = 'backup-printer-selected';

View File

@ -0,0 +1,35 @@
CREATE TABLE IF NOT EXISTS pbx.prefix (
country CHAR(2) NOT NULL COMMENT 'Country code',
prefix varchar(100) NOT NULL COMMENT 'Country prefix',
CONSTRAINT prefix_pk PRIMARY KEY (country)
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci;
ALTER TABLE pbx.config
CHANGE countryPrefix defaultPrefix varchar(20)
CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;
ALTER TABLE pbx.config DROP COLUMN IF EXISTS sundayFestive;
CREATE TABLE IF NOT EXISTS pbx.holiday (
id INT UNSIGNED auto_increment NOT NULL,
country CHAR(2) NOT NULL,
`day` DATE NOT NULL,
CONSTRAINT holiday_pk PRIMARY KEY (id)
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci;
CREATE UNIQUE INDEX holiday_country_IDX USING BTREE ON pbx.holiday (country,`day`);
ALTER TABLE pbx.schedule
CHANGE timeStart startTime time NOT NULL,
CHANGE timeEnd endTime time NOT NULL,
DROP FOREIGN KEY schedule_ibfk_1,
DROP COLUMN queue,
ADD country CHAR(2) NOT NULL,
CHANGE weekDay weekDays set('mon','tue','wed','thu','fri','sat','sun') NOT NULL
COMMENT '0 = Monday, 6 = Sunday';

View File

@ -0,0 +1,13 @@
INSERT INTO pbx.prefix (country,prefix)
VALUES ('es','0034');
INSERT INTO pbx.prefix (country,prefix)
VALUES ('fr','0033');
INSERT INTO pbx.prefix (country,prefix)
VALUES ('pt','00351');
INSERT INTO pbx.schedule (weekDays,startTime,endTime,country)
VALUES ('mon,tue,wed,thu,fri,sat,sun','00:00','24:00','es');
INSERT INTO pbx.schedule (weekDays,startTime,endTime,country)
VALUES ('mon,tue,wed,thu,fri,sat,sun','00:00','24:00','fr');
INSERT INTO pbx.schedule (weekDays,startTime,endTime,country)
VALUES ('mon,tue,wed,thu,fri,sat,sun','00:00','24:00','pt');

View File

@ -0,0 +1,5 @@
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_getRisk`()
BEGIN
END;
GRANT EXECUTE ON PROCEDURE vn.client_getRisk TO financialBoss;

View File

@ -98,40 +98,38 @@ module.exports = Self => {
let stmts = [];
const stmt = new ParameterizedSQL(`
SELECT *
FROM (
SELECT t.cmrFk,
t.id ticketFk,
t.routeFk,
co.country,
t.clientFk,
IF(sub.id, TRUE, FALSE) hasCmrDms,
DATE(t.shipped) shipped
FROM ticket t
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state s ON s.id = ts.stateFk
JOIN alertLevel al ON al.id = s.alertLevel
JOIN client c ON c.id = t.clientFk
JOIN address a ON a.id = t.addressFk
JOIN province p ON p.id = a.provinceFk
JOIN country co ON co.id = p.countryFk
JOIN agencyMode am ON am.id = t.agencyModeFk
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
JOIN warehouse w ON w.id = t.warehouseFk
LEFT JOIN (
SELECT td.ticketFk, d.id
FROM ticketDms td
JOIN dms d ON d.id = td.dmsFk
JOIN dmsType dt ON dt.id = d.dmsTypeFk
WHERE dt.name = 'cmr'
) sub ON sub.ticketFk = t.id
WHERE co.code <> 'ES'
AND am.name <> 'ABONO'
AND w.code = 'ALG'
AND dm.code = 'DELIVERY'
AND t.cmrFk
) sub
`);
SELECT *
FROM (
SELECT t.cmrFk,
t.id ticketFk,
t.routeFk,
co.country,
t.clientFk,
IF(sub.id, TRUE, FALSE) hasCmrDms,
DATE(t.shipped) shipped
FROM ticket t
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state s ON s.id = ts.stateFk
JOIN alertLevel al ON al.id = s.alertLevel
JOIN client c ON c.id = t.clientFk
JOIN address a ON a.id = t.addressFk
JOIN province p ON p.id = a.provinceFk
JOIN country co ON co.id = p.countryFk
JOIN agencyMode am ON am.id = t.agencyModeFk
JOIN warehouse w ON w.id = t.warehouseFk
LEFT JOIN (
SELECT td.ticketFk, d.id
FROM ticketDms td
JOIN dms d ON d.id = td.dmsFk
JOIN dmsType dt ON dt.id = d.dmsTypeFk
WHERE dt.name = 'cmr'
) sub ON sub.ticketFk = t.id
WHERE co.code <> 'ES'
AND am.name <> 'ABONO'
AND w.code = 'ALG'
AND t.cmrFk
) sub
`);
stmt.merge(conn.makeSuffix(filter));
const itemsIndex = stmts.push(stmt) - 1;

View File

@ -48,7 +48,7 @@
"type": "number",
"required": false
},
"mainPrinterFk": {
"backupPrinterFk": {
"type": "number",
"required": false
},

View File

@ -152,7 +152,10 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) {
VALUES ('invoicingTicketError', ?)
`, [ticket.id + ' - ' + error]);
// Domain not found
if (error.responseCode == 450) return invalidEmail(ticket);
if (error.responseCode == 450) {
await invalidEmail(ticket);
continue;
}
// Save tickets on a list of failed ids
failedtickets.push({

View File

@ -3,60 +3,80 @@ const models = require('vn-loopback/server/server').models;
describe('Operator', () => {
const authorFk = 9;
const sectorId = 1;
const mainPrinter = 1;
const notificationName = 'not-main-printer-configured';
const operator = {
workerFk: 1,
trainFk: 1,
itemPackingTypeFk: 'H',
warehouseFk: 1,
sectorFk: sectorId
};
const labeler = 1;
const notificationName = 'backup-printer-selected';
const sentStatus = 'sent';
async function createOperator(labelerFk, options) {
operator.labelerFk = labelerFk;
await models.Operator.create(operator, options);
return models.NotificationQueue.findOne({
where: {
notificationFk: notificationName
}
}, options);
beforeEach(async() => {
await deleteNotification();
});
afterAll(async() => {
await deleteNotification();
});
async function deleteNotification() {
await models.NotificationQueue.destroyAll({notificationFk: notificationName});
}
it('should create notification when configured a not main printer in the sector', async() => {
const tx = await models.Operator.beginTransaction({});
async function updateOperatorAndFindNotification(labelerFk = labeler) {
await models.Operator.updateAll({id: authorFk}, {workerFk: authorFk, labelerFk: labelerFk, sectorFk: sectorId});
return models.NotificationQueue.findOne({order: 'id DESC'});
}
it('should create notification when configured a backup printer in the sector', async() => {
const notificationQueue = await updateOperatorAndFindNotification();
const params = JSON.parse(notificationQueue.params);
expect(notificationQueue.notificationFk).toEqual(notificationName);
expect(notificationQueue.authorFk).toEqual(authorFk);
expect(params.labelerId).toEqual(1);
expect(params.sectorId).toEqual(1);
expect(params.workerId).toEqual(9);
});
it('should not create notification when configured a non backup printer in the sector', async() => {
const notificationQueue = await updateOperatorAndFindNotification(2);
expect(notificationQueue?.notificationFk).not.toEqual(notificationName);
});
it('should create notification when delay is null', async() => {
const config = await models.ProductionConfig.findOne();
const delay = config.backupPrinterNotificationDelay;
await config.updateAttributes({backupPrinterNotificationDelay: null});
const lastNotification = await updateOperatorAndFindNotification();
await config.updateAttributes({backupPrinterNotificationDelay: delay});
expect(lastNotification.notificationFk).toEqual(notificationName);
});
it('should not sent notification when is already notified by another worker', async() => {
try {
const options = {transaction: tx, accessToken: {userId: authorFk}};
const notificationQueue = await createOperator(2, options);
const params = JSON.parse(notificationQueue.params);
expect(notificationQueue.notificationFk).toEqual(notificationName);
expect(notificationQueue.authorFk).toEqual(authorFk);
expect(params.labelerId).toEqual(2);
expect(params.sectorId).toEqual(1);
expect(params.workerId).toEqual(9);
await tx.rollback();
await models.NotificationQueue.create({
authorFk: 2,
notificationFk: notificationName,
params: JSON.stringify({'labelerId': labeler, 'sectorId': sectorId, 'workerId': 2}),
created: '2001-01-01 12:30:00',
status: sentStatus
});
await models.Operator.updateAll({id: 1}, {labelerFk: labeler, sectorFk: sectorId});
} catch (e) {
await tx.rollback();
throw e;
expect(e.message).toEqual('Previous notification sended with the same parameters');
}
});
it('should not create notification when configured the main printer in the sector', async() => {
const tx = await models.Operator.beginTransaction({});
it('should send a notification when the previous one has distinct params', async() => {
await models.NotificationQueue.create({
authorFk: 2,
notificationFk: notificationName,
params: JSON.stringify({'labelerId': labeler, 'sectorId': 2, 'workerId': 1}),
created: '2001-01-01 12:30:00',
status: sentStatus
});
const lastNotification = await updateOperatorAndFindNotification();
try {
const options = {transaction: tx, accessToken: {userId: authorFk}};
const notificationQueue = await createOperator(mainPrinter, options);
expect(notificationQueue).toEqual(null);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
expect(lastNotification.notificationFk).toEqual(notificationName);
});
});

View File

@ -1,19 +1,41 @@
module.exports = Self => {
Self.observe('after save', async function(ctx) {
Self.observe('after save', async ctx => {
const instance = ctx.data || ctx.instance;
const models = Self.app.models;
const options = ctx.options;
const notificationName = 'backup-printer-selected';
const userId = ctx.options.accessToken?.userId || instance.workerFk;
if (!instance?.sectorFk || !instance?.labelerFk) return;
const sector = await models.Sector.findById(instance.sectorFk, {
fields: ['mainPrinterFk']
fields: ['backupPrinterFk']
}, options);
if (sector.mainPrinterFk && sector.mainPrinterFk != instance.labelerFk) {
const userId = ctx.options.accessToken.userId;
if (sector.backupPrinterFk && sector.backupPrinterFk == instance.labelerFk) {
const {labelerFk, sectorFk} = instance;
const {backupPrinterNotificationDelay} = await models.ProductionConfig.findOne();
if (backupPrinterNotificationDelay) {
const notifications = await models.NotificationQueue.find(
{where: {created: {gte: Date.vnNow() - (backupPrinterNotificationDelay * 1000) + (3600 * 1000)},
notificationFk: notificationName,
status: 'sent'
}
});
const criteria = {labelerId: labelerFk, sectorId: sectorFk};
const filteredNotifications = notifications.filter(notification => {
const paramsObj = JSON.parse(notification.params);
return Object.keys(criteria).every(key => criteria[key] === paramsObj?.[key]);
});
if (filteredNotifications.length >= 1)
throw new Error('Previous notification sended with the same parameters');
}
await models.NotificationQueue.create({
notificationFk: 'not-main-printer-configured',
notificationFk: notificationName,
authorFk: userId,
params: JSON.stringify(
{
@ -22,7 +44,8 @@ module.exports = Self => {
'workerId': userId
}
)
}, options);
});
}
});
};

View File

@ -0,0 +1,14 @@
<email-body v-bind="$props">
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<h1>{{ $t('title') }}</h1>
<p v-html="$t('description',
[
worker.nickname,
labeler.id,
sector.description,
]
)"/>
</div>
</div>
</email-body>

View File

@ -2,15 +2,14 @@ const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
module.exports = {
name: 'not-main-printer-configured',
name: 'backup-printer-selected',
async serverPrefetch() {
this.sector = await this.findOneFromDef('sector', [this.sectorId]);
if (!this.sector)
throw new Error('Something went wrong');
this.labeler = await this.findOneFromDef('printer', [this.labelerId]);
this.mainPrinter = await this.findOneFromDef('printer', [this.sector.mainPrinterFk]);
this.mainPrinter = await this.findOneFromDef('printer', [this.sector.backupPrinterFk]);
this.worker = await this.findOneFromDef('worker', [this.workerId]);
},
components: {
@ -29,5 +28,6 @@ module.exports = {
type: Number,
required: true
}
}
};

View File

@ -0,0 +1,3 @@
subject: Not main printer configured
title: Not main printer configured
description: 'The worker {0} is using the backup printer {1} for their sector {2}.'

View File

@ -0,0 +1,3 @@
subject: Seleccionada impresora de repuesto
title: Seleccionada impresora de repuesto
description: 'El trabajador {0} esta utilizando la impresora de repuesto {1} del sector {2}.'

View File

@ -1,3 +1,4 @@
SELECT id, name
SELECT id,
name
FROM vn.printer
WHERE id = ?

View File

@ -0,0 +1,5 @@
SELECT id,
description,
backupPrinterFk
FROM vn.sector
WHERE id = ?

View File

@ -1,3 +0,0 @@
subject: Not main printer configured
title: Not main printer configured
description: 'Printer #{0} {1} has been configured in sector #{2} {3} (the main printer for that sector is #{4} {5}). Ask the worker {6}.'

View File

@ -1,3 +0,0 @@
subject: Configurada impresora no principal
title: Configurada impresora no principal
description: 'Se ha configurado la impresora #{0} {1} en el sector #{2} {3} (la impresora principal de ese sector es la #{4} {5}). Preguntar al trabajador {6}.'

View File

@ -1,8 +0,0 @@
<email-body v-bind="$props">
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<h1>{{ $t('title') }}</h1>
<p v-html="$t('description', [labeler.id, labeler.name, sector.id, sector.description, mainPrinter.id, mainPrinter.name, worker.nickname])"></p>
</div>
</div>
</email-body>

View File

@ -1,3 +0,0 @@
SELECT id, description, mainPrinterFk
FROM vn.sector
WHERE id = ?

18
win/Content.md Normal file
View File

@ -0,0 +1,18 @@
# win
In this folder, there are two scripts:
1- 'addRule' : adds a rule to the Windows firewall to accept requests on ports 3000 and 5000.
2- 'redirect' : allows redirecting ports 3000 and 5000 so that our machine processes them with our local Salix server.
## Run
Two ways:
1-Search the project of Salix in WSL with the explorer of windows, for example: \\wsl.localhost\Debian\home\your_user\projects\salix and with a terminal Powershell with administrator permissions execute addRule.ps1 only one time and execute redirect.ps1 every time you need redirect ports when the project is running.
2-Search the project of Salix in WSL with the explorer of windows and edit the files with .lnk with the path of your installation of Salix. So , you will have a direct link for execute.
## Server
To access your Salix server, you can directly enter the IP or name of your computer along with the corresponding port

26
win/addRule.ps1 Normal file
View File

@ -0,0 +1,26 @@
# Definir las propiedades de la nueva regla
# Define el nombre de la regla
$ruleName = "salixRule"
# Define el perfil de la regla (Dominio, Privado, P<>blico)
$profile = "Domain,Private,Public"
# Define la acción (Permitir/Bloquear)
$action = "Allow"
# Define el protocolo (TCP/UDP)
$protocol = "TCP"
# Define el puerto local
$port = 3000, 5000
# Define una descripción (opcional)
$description = "Permitir tráfico HTTP.Frontend y backend Salix."
# Crea la regla de firewall
New-NetFirewallRule -DisplayName $ruleName -Profile $profile -Action $action -Protocol $protocol -LocalPort $port -Description $description
# Imprime un mensaje de confirmación
Write-Host "Regla de firewall creada exitosamente: $ruleName"
pause

BIN
win/powershellAddRule.lnk Normal file

Binary file not shown.

BIN
win/powershellRedirect.lnk Normal file

Binary file not shown.

5
win/redirect.ps1 Normal file
View File

@ -0,0 +1,5 @@
# Redireccionar ports
$wslip = ((wsl hostname -I) -split " ")[0]
netsh interface portproxy set v4tov4 listenport=3000 listenaddress=0.0.0.0 connectport=3000 connectaddress=$wslip
netsh interface portproxy set v4tov4 listenport=5000 listenaddress=0.0.0.0 connectport=5000 connectaddress=$wslip