7152-devToTest_2414 #2228

Merged
alexm merged 636 commits from 7152-devToTest_2414 into test 2024-03-28 08:26:34 +00:00
2 changed files with 2 additions and 673 deletions
Showing only changes of commit a4c3d78e31 - Show all commits

View File

@ -3008,675 +3008,4 @@ INSERT INTO `vn`.`invoiceCorrectionType` (`id`, `description`)
VALUES
(1, 'Error in VAT calculation'),
(2, 'Error in sales details'),
(3, 'Error in customer data');
/*
Se necesitan, para hacer un simulacro de pedido, lo siguiente:
- Warehouse 999
- Sectores
- Normal 9991
- Previa 9992
- Altillo 9993
- Parkings
- Normal A-01-1, A-02-2, B-03-3, B-04-4, C-05-5
- Previa P-01-1, P-02-2, P-03-3
- Altillo M-01-1, M-02-2, M-03-3
- Shelvings
- Normal NAA, NBB, NCC, NDD, NEE
- Previa PAA, PBB, PCC
- Altillo MAA, MBB, MCC
- Items
* Normal
* Previa:
- Ticket
- Sales
*/
INSERT IGNORE INTO intrastat
SET id = 44219999,
description = 'Manufacturas de madera',
taxClassFk = 1,
taxCodeFk = 1;
INSERT IGNORE INTO warehouse
SET id = 999,
name = 'TestingWarehouse',
hasAvailable = TRUE,
isForTicket = TRUE,
isInventory = TRUE,
hasUbications = TRUE,
hasProduction = TRUE;
INSERT IGNORE INTO sector
SET id = 9991,
description = 'NormalSector',
warehouseFk = 999,
isPreviousPreparedByPacking = FALSE,
code = 'NS',
isPreviousPrepared = FALSE,
isPackagingArea = FALSE,
sonFk = NULL,
isMain = TRUE,
itemPackingTypeFk = NULL;
INSERT IGNORE INTO sector
SET id = 9992,
description = 'PreviousSector',
warehouseFk = 999,
isPreviousPreparedByPacking = FALSE,
code = 'PS',
isPreviousPrepared = TRUE,
isPackagingArea = FALSE,
sonFk = NULL,
isMain = TRUE,
itemPackingTypeFk = NULL;
INSERT IGNORE INTO sector
SET id = 9993,
description = 'MezaninneSector',
warehouseFk = 999,
isPreviousPreparedByPacking = TRUE,
code = 'MS',
isPreviousPrepared = FALSE,
isPackagingArea = FALSE,
sonFk = 9991,
isMain = TRUE,
itemPackingTypeFk = NULL;
REPLACE parking SET id = 9991011, sectorFk = 9991, code = 'A-01-1', pickingOrder = 1;
REPLACE parking SET id = 9991012, sectorFk = 9991, code = 'A-02-2', pickingOrder = 2;
REPLACE parking SET id = 9991013, sectorFk = 9991, code = 'A-03-3', pickingOrder = 3;
REPLACE parking SET id = 9991014, sectorFk = 9991, code = 'A-04-4', pickingOrder = 4;
REPLACE parking SET id = 9991015, sectorFk = 9991, code = 'A-05-5', pickingOrder = 5;
REPLACE parking SET id = 9992011, sectorFk = 9992, code = 'P-01-1', pickingOrder = 6;
REPLACE parking SET id = 9992012, sectorFk = 9992, code = 'P-02-2', pickingOrder = 7;
REPLACE parking SET id = 9992013, sectorFk = 9992, code = 'P-03-3', pickingOrder = 8;
REPLACE parking SET id = 9993011, sectorFk = 9993, code = 'M-01-1', pickingOrder = 9;
REPLACE parking SET id = 9993012, sectorFk = 9993, code = 'M-02-2', pickingOrder = 10;
REPLACE parking SET id = 9993013, sectorFk = 9993, code = 'M-03-3', pickingOrder = 11;
REPLACE shelving SET code = 'NAA', parkingFk = 9991011, priority = 1;
REPLACE shelving SET code = 'NBB', parkingFk = 9991012, priority = 1;
REPLACE shelving SET code = 'NCC', parkingFk = 9991013, priority = 1;
REPLACE shelving SET code = 'NDD', parkingFk = 9991014, priority = 1;
REPLACE shelving SET code = 'NEE', parkingFk = 9991015, priority = 1;
REPLACE shelving SET code = 'PAA', parkingFk = 9992011, priority = 1;
REPLACE shelving SET code = 'PBB', parkingFk = 9992012, priority = 1;
REPLACE shelving SET code = 'PCC', parkingFk = 9992013, priority = 1;
REPLACE shelving SET code = 'MAA', parkingFk = 9993011, priority = 1;
REPLACE shelving SET code = 'MBB', parkingFk = 9993012, priority = 1;
REPLACE shelving SET code = 'MCC', parkingFk = 9993013, priority = 1;
INSERT IGNORE INTO itemType
SET id = 999,
code = 'WOO',
name = 'Wood Objects',
categoryFk = 3,
workerFk = 103,
isInventory = TRUE,
life = 10,
density = 250,
itemPackingTypeFk = NULL,
temperatureFk = 'warm';
INSERT IGNORE INTO travel
SET id = 99,
shipped = CURDATE(),
landed = CURDATE(),
warehouseInFk = 999,
warehouseOutFk = 1,
isReceived = TRUE,
agencyFk = 1;
REPLACE entry
SET id = 999,
supplierFk = 791,
isConfirmed = TRUE,
dated = CURDATE(),
travelFk = 99,
companyFk = 442;
REPLACE ticket
SET id = 999999,
clientFk = 2,
warehouseFk = 999,
shipped = CURDATE(),
nickname = 'Cliente',
addressFk = 1,
companyFk = 442,
agencyModeFk = 10,
landed = CURDATE();
REPLACE collection
SET id = 10101010,
workerFk = 103;
INSERT IGNORE INTO ticketCollection
SET id = 10101010,
ticketFk = 999999,
collectionFk = 10101010;
REPLACE item
SET id = 999991,
name = 'Palito para pinchos',
`size` = 25,
stems = NULL,
category = 'EXT',
typeFk = 999,
longName = 'Palito para pinchos',
itemPackingTypeFk = NULL,
originFk = 1,
weightByPiece = 6,
intrastatFk = 44219999;
REPLACE buy
SET id = 9999991,
entryFk = 999,
itemFk = 999991,
quantity = 8,
buyingValue = 0.61,
stickers = 1,
packing = 20,
`grouping` = 1,
groupingMode = 1,
packageFk = 94,
price1 = 1,
price2 = 1,
price3 = 1,
minPrice = 1,
weight = 50;
REPLACE sale
SET id = 99991,
itemFk = 999991,
ticketFk = 999999,
concept = 'Palito para pinchos',
quantity = 3,
price = 1,
discount = 0;
REPLACE item
SET id = 999992,
name = 'Madera verde',
`size` = 10,
stems = NULL,
category = 'EXT',
typeFk = 999,
longName = 'Madera verde',
itemPackingTypeFk = NULL,
originFk = 1,
weightByPiece = 50,
intrastatFk = 44219999;
REPLACE buy
SET id = 9999992,
entryFk = 999,
itemFk = 999992,
quantity = 40,
buyingValue = 0.62,
stickers = 1,
packing = 40,
`grouping` = 5,
groupingMode = 1,
packageFk = 94,
price1 = 1,
price2 = 1,
price3 = 1,
minPrice = 1,
weight = 25;
REPLACE sale
SET id = 99992,
itemFk = 999992,
ticketFk = 999999,
concept = 'Madera Verde',
quantity = 10,
price = 1,
discount = 0;
REPLACE item
SET id = 999993,
name = 'Madera Roja/Morada',
`size` = 12,
stems = 2,
category = 'EXT',
typeFk = 999,
longName = 'Madera Roja/Morada',
itemPackingTypeFk = NULL,
originFk = 1,
weightByPiece = 35,
intrastatFk = 44219999;
REPLACE buy
SET id = 9999993,
entryFk = 999,
itemFk = 999993,
quantity = 20,
buyingValue = 0.63,
stickers = 2,
packing = 10,
`grouping` = 5,
groupingMode = 1,
packageFk = 94,
price1 = 1,
price2 = 1,
price3 = 1,
minPrice = 1,
weight = 25;
REPLACE itemShelving
SET id = 9931,
itemFk = 999993,
shelvingFk = 'NCC',
visible = 10,
`grouping` = 5,
packing = 10;
REPLACE sale
SET id = 99993,
itemFk = 999993,
ticketFk = 999999,
concept = 'Madera Roja/Morada',
quantity = 15,
price = 1,
discount = 0;
REPLACE item
SET id = 999994,
name = 'Madera Naranja',
`size` = 18,
stems = 1,
category = 'EXT',
typeFk = 999,
longName = 'Madera Naranja',
itemPackingTypeFk = NULL,
originFk = 1,
weightByPiece = 160,
intrastatFk = 44219999;
REPLACE buy
SET id = 9999994,
entryFk = 999,
itemFk = 999994,
quantity = 20,
buyingValue = 0.64,
stickers = 1,
packing = 20,
`grouping` = 4,
groupingMode = 1,
packageFk = 94,
price1 = 1,
price2 = 1,
price3 = 1,
minPrice = 1,
weight = 25;
REPLACE sale
SET id = 99994,
itemFk = 999994,
ticketFk = 999999,
concept = 'Madera Naranja',
quantity = 4,
price = 1,
discount = 0;
REPLACE item
SET id = 999995,
name = 'Madera Amarilla',
`size` = 11,
stems = 5,
category = 'EXT',
typeFk = 999,
longName = 'Madera Amarilla',
itemPackingTypeFk = NULL,
originFk = 1,
weightByPiece = 78,
intrastatFk = 44219999;
REPLACE buy
SET id = 9999995,
entryFk = 999,
itemFk = 999995,
quantity = 4,
buyingValue = 0.65,
stickers = 1,
packing = 20,
`grouping` = 1,
groupingMode = 1,
packageFk = 94,
price1 = 1,
price2 = 1,
price3 = 1,
minPrice = 1,
weight = 35;
REPLACE sale
SET id = 99995,
itemFk = 999995,
ticketFk = 999999,
concept = 'Madera Amarilla',
quantity = 5,
price = 1,
discount = 0;
-- Palito naranja
REPLACE item
SET id = 999998,
name = 'Palito naranja',
`size` = 11,
stems = 1,
category = 'EXT',
typeFk = 999,
longName = 'Palito naranja',
itemPackingTypeFk = NULL,
originFk = 1,
weightByPiece = 78,
intrastatFk = 44219999;
REPLACE buy
SET id = 9999998,
entryFk = 999,
itemFk = 999998,
quantity = 80,
buyingValue = 0.65,
stickers = 1,
packing = 200,
`grouping` = 30,
groupingMode = 1,
packageFk = 94,
price1 = 1,
price2 = 1,
price3 = 1,
minPrice = 1,
weight = 35;
REPLACE sale
SET id = 99998,
itemFk = 999998,
ticketFk = 999999,
concept = 'Palito naranja',
quantity = 60,
price = 1,
discount = 0;
-- Palito amarillo
REPLACE item
SET id = 999999,
name = 'Palito amarillo',
`size` = 11,
stems = 1,
category = 'EXT',
typeFk = 999,
longName = 'Palito amarillo',
itemPackingTypeFk = NULL,
originFk = 1,
weightByPiece = 78,
intrastatFk = 44219999;
REPLACE buy
SET id = 9999999,
entryFk = 999,
itemFk = 999999,
quantity = 70,
buyingValue = 0.65,
stickers = 1,
packing = 500,
`grouping` = 10,
groupingMode = 1,
packageFk = 94,
price1 = 1,
price2 = 1,
price3 = 1,
minPrice = 1,
weight = 35;
REPLACE sale
SET id = 99999,
itemFk = 999999,
ticketFk = 999999,
concept = 'Palito amarillo',
quantity = 50,
price = 1,
discount = 0;
-- Palito azul
REPLACE item
SET id = 1000000,
name = 'Palito azul',
`size` = 10,
stems = 1,
category = 'EXT',
typeFk = 999,
longName = 'Palito azul',
itemPackingTypeFk = NULL,
originFk = 1,
weightByPiece = 78,
intrastatFk = 44219999;
REPLACE buy
SET id = 10000000,
entryFk = 999,
itemFk = 1000000,
quantity = 75,
buyingValue = 0.65,
stickers = 2,
packing = 300,
`grouping` = 50,
groupingMode = 1,
packageFk = 94,
price1 = 1,
price2 = 1,
price3 = 1,
minPrice = 1,
weight = 35;
REPLACE sale
SET id = 100000,
itemFk = 1000000,
ticketFk = 999999,
concept = 'Palito azul',
quantity = 50,
price = 1,
discount = 0;
-- Palito rojo
REPLACE item
SET id = 1000001,
name = 'Palito rojo',
`size` = 10,
stems = NULL,
category = 'EXT',
typeFk = 999,
longName = 'Palito rojo',
itemPackingTypeFk = NULL,
originFk = 1,
weightByPiece = 78,
intrastatFk = 44219999;
REPLACE buy
SET id = 10000001,
entryFk = 999,
itemFk = 1000001,
quantity = 12,
buyingValue = 0.65,
stickers = 2,
packing = 50,
`grouping` = 5,
groupingMode = 1,
packageFk = 94,
price1 = 1,
price2 = 1,
price3 = 1,
minPrice = 1,
weight = 35;
REPLACE sale
SET id = 100001,
itemFk = 1000001,
ticketFk = 999999,
concept = 'Palito rojo',
quantity = 10,
price = 1,
discount = 0;
-- Previa
INSERT IGNORE INTO item
SET id = 999996,
name = 'Bolas de madera',
`size` = 2,
stems = 4,
category = 'EXT',
typeFk = 999,
longName = 'Bolas de madera',
itemPackingTypeFk = NULL,
originFk = 1,
weightByPiece = 20,
intrastatFk = 44219999;
REPLACE buy
SET id = 9999996,
entryFk = 999,
itemFk = 999996,
quantity = 5,
buyingValue = 3,
stickers = 1,
packing = 5,
`grouping` = 2,
groupingMode = 1,
packageFk = 94,
price1 = 7,
price2 = 7,
price3 = 7,
minPrice = 7,
weight = 80;
REPLACE sale
SET id = 99996,
itemFk = 999996,
ticketFk = 999999,
concept = 'Bolas de madera',
quantity = 4,
price = 7,
discount = 0,
isPicked = TRUE;
INSERT IGNORE INTO item
SET id = 999997,
name = 'Palitos de polo MIX',
`size` = 14,
stems = NULL,
category = 'EXT',
typeFk = 999,
longName = 'Palitos de polo MIX',
itemPackingTypeFk = NULL,
originFk = 1,
weightByPiece = 20,
intrastatFk = 44219999;
REPLACE buy
SET id = 9999997,
entryFk = 999,
itemFk = 999997,
quantity = 100,
buyingValue = 3.2,
stickers = 1,
packing = 100,
`grouping` = 5,
groupingMode = 1,
packageFk = 94,
price1 = 7,
price2 = 7,
price3 = 7,
minPrice = 7,
weight = 80;
REPLACE sale
SET id = 99997,
itemFk = 999997,
ticketFk = 999999,
concept = 'Palitos de polo MIX',
quantity = 5,
price = 7,
discount = 0;
-- Ubicación
DELETE ish.*
FROM itemShelving ish
JOIN shelving sh ON sh.code = ish.shelvingFk
JOIN parking p ON p.id = sh.parkingFk
JOIN sector s ON s.id = p.sectorFk
JOIN warehouse w ON w.id = s.warehouseFk
WHERE w.name = 'TestingWarehouse';
REPLACE vn.itemShelving
(id, itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked)
VALUES
(9911, 999991, 'NAA', 8, '2023-09-20', 1, 20, NULL, 103, NULL),
(9912, 999998, 'NAA', 80, '2023-09-20', 10, 30, NULL, 103, NULL),
(9913, 1000001, 'NAA', 6, '2023-09-20', 3, 50, NULL, 103, NULL),
(9914, 1000000, 'NBB', 50, '2023-09-18', 25, 500, NULL, 103, NULL),
(9915, 999993, 'NBB', 25, '2023-09-18', NULL, 10, NULL, 103, NULL),
(9916, 999999, 'NBB', 30, '2023-09-18', 10, 500, NULL, 103, NULL),
(9917, 999993, 'NCC', 25, '2023-09-20', 5, 10, NULL, 103, NULL),
(9918, 999997, 'NCC', 10, '2023-09-20', NULL, 100, NULL, 103, NULL),
(9919, 999999, 'NCC', 40, '2023-09-20', 10, 500, NULL, 103, NULL),
(9920, 999995, 'NDD', 10, '2023-09-19', NULL, 20, NULL, 103, NULL),
(9921, 999994, 'NDD', 48, '2023-09-19', 4, 20, NULL, 103, NULL),
(9922, 1000001, 'NEE', 6, '2023-09-21', 3, 50, NULL, 103, NULL),
(9923, 999992, 'NEE', 50, '2023-09-21', NULL, 1, NULL, 103, NULL),
(9924, 1000000, 'NEE', 25, '2023-09-21', 25, 500, NULL, 103, NULL),
(9925, 999996, 'PAA', 5, '2023-09-27', 1, 5, NULL, 103, NULL),
(9926, 999997, 'PCC', 10, '2023-09-27', 5, 100, NULL, 103, NULL);
-- Previous for Bolas de madera
INSERT IGNORE INTO sectorCollection
SET id = 99,
userFk = 1,
sectorFk = 9992;
INSERT IGNORE INTO saleGroup
SET id = 999,
userFk = 1,
parkingFk = 9992011,
sectorFk = 9992;
INSERT IGNORE INTO sectorCollectionSaleGroup
SET id = 9999,
sectorCollectionFk = 99,
saleGroupFk = 999;
REPLACE saleGroupDetail
SET id = 99991,
saleFk = 99996,
saleGroupFk = 999;
REPLACE saleTracking
SET saleFk = 99996,
isChecked = TRUE,
workerFk = 103,
stateFk = 28;
INSERT IGNORE INTO itemShelvingSale
SET id = 991,
itemShelvingFk = 9962,
saleFk = 99996,
quantity = 5,
userFk = 1;
CALL itemShelvingSale_reserveByCollection(10101010);
UPDATE vn.collection
SET workerFk=9
WHERE id=10101010;
INSERT INTO `vn`.`machineWorkerConfig` (id, maxHours)
VALUES (1, 12)
(3, 'Error in customer data');

View File

@ -29,7 +29,7 @@ module.exports = Self => {
if (typeof options == 'object') Object.assign(myOptions, options);
const sales = await Self.rawSql('CALL vn.sectorCollection_getSale(?)', [sectorCollectionFk]);
const [sales] = await Self.rawSql('CALL vn.sectorCollection_getSale(?)', [sectorCollectionFk]);
const itemShelvings = [];
for (let sale of sales) {