Merge branch 'test' into 8030-testPriceDelta
gitea/salix/pipeline/pr-test This commit looks good
Details
gitea/salix/pipeline/pr-test This commit looks good
Details
This commit is contained in:
commit
d87f940fff
|
@ -15,9 +15,6 @@
|
||||||
"nickname": {
|
"nickname": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
|
|
|
@ -179,12 +179,12 @@ INSERT INTO `vn`.`country`(`id`, `name`, `isUeeMember`, `code`, `currencyFk`, `i
|
||||||
(30,'Canarias', 1, 'IC', 1, 24, 4, 1, 2);
|
(30,'Canarias', 1, 'IC', 1, 24, 4, 1, 2);
|
||||||
|
|
||||||
INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasDms`, `hasComission`, `countryFk`, `hasProduction`, `isOrigin`, `isDestiny`)
|
INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasDms`, `hasComission`, `countryFk`, `hasProduction`, `isOrigin`, `isDestiny`)
|
||||||
VALUES (1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
VALUES
|
||||||
|
(1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||||
(2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 1, 13, 1, 1, 0),
|
(2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 1, 13, 1, 1, 0),
|
||||||
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0),
|
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0),
|
||||||
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1),
|
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1),
|
||||||
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
|
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
|
||||||
(6, 'Warehouse six', 'VNH', 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
|
|
||||||
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0),
|
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0),
|
||||||
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0);
|
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0);
|
||||||
|
|
||||||
|
@ -1497,16 +1497,16 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk
|
||||||
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`)
|
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`)
|
||||||
VALUES (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1),
|
VALUES
|
||||||
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150.00, 2000, 'second travel', 2, 2, 2),
|
(1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1),
|
||||||
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3),
|
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2, 2, 2),
|
||||||
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4),
|
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3),
|
||||||
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5),
|
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4),
|
||||||
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6),
|
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5),
|
||||||
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7),
|
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6),
|
||||||
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10),
|
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7),
|
||||||
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10),
|
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10),
|
||||||
(11, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4);
|
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10);
|
||||||
|
|
||||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
|
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1519,8 +1519,7 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed
|
||||||
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'),
|
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'),
|
||||||
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''),
|
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''),
|
||||||
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''),
|
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''),
|
||||||
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, 1, ''),
|
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, '');
|
||||||
(99, 69, '2000-12-01 00:00:00.000', 11, 0, 442, 'IN2009', 'Movement 99', 1, 1, '');
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
|
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
|
||||||
VALUES (2, 4, 1);
|
VALUES (2, 4, 1);
|
||||||
|
@ -1543,7 +1542,7 @@ INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `sal
|
||||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12', '56.20', '56.20', '56.20'),
|
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12', '56.20', '56.20', '56.20'),
|
||||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20', '56.20', '56.20', '56.20');
|
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20', '56.20', '56.20', '56.20');
|
||||||
|
|
||||||
INSERT INTO vn.buy(id,entryFk,itemFk,buyingValue,quantity,packagingFk,stickers,freightValue,packageValue,comissionValue,packing,grouping,groupingMode,location,price1,price2,price3,printedStickers,isChecked,isIgnored,weight,created)
|
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packagingFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH),
|
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH),
|
||||||
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 1 MONTH),
|
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 1 MONTH),
|
||||||
|
@ -1559,8 +1558,7 @@ INSERT INTO vn.buy(id,entryFk,itemFk,buyingValue,quantity,packagingFk,stickers,f
|
||||||
(12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
|
(12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
|
||||||
(13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()),
|
(13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()),
|
||||||
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 7.30, 7.00, 0, 1, 0, 4, util.VN_CURDATE()),
|
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 7.30, 7.00, 0, 1, 0, 4, util.VN_CURDATE()),
|
||||||
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
|
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE());
|
||||||
(16, 99,1,50.0000, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.60, 99.40, 0, 1, 0, 1.00, '2024-07-30 08:13:51.000');
|
|
||||||
|
|
||||||
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
|
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -3937,37 +3935,43 @@ INSERT INTO vn.medicalReview
|
||||||
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
|
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
|
||||||
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
|
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
|
||||||
|
|
||||||
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
|
INSERT INTO vn.payrollComponent
|
||||||
VALUES(35, 1.00, 1.00, '2001-01-01');
|
(id, name, isSalaryAgreed, isVariable, isException)
|
||||||
|
VALUES
|
||||||
INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)
|
(1, 'Salario1', 1, 0, 0),
|
||||||
VALUES (1,0.6,6);
|
|
||||||
|
|
||||||
INSERT INTO vn.payrollComponent (id, name, isSalaryAgreed, isVariable, isException)
|
|
||||||
VALUES (1, 'Salario1', 1, 0, 0),
|
|
||||||
(2, 'Salario2', 1, 1, 0),
|
(2, 'Salario2', 1, 1, 0),
|
||||||
(3, 'Salario3', 1, 0, 1);
|
(3, 'Salario3', 1, 0, 1);
|
||||||
|
|
||||||
INSERT INTO vn.workerIncome (debit, credit, incomeTypeFk, paymentDate, workerFk, concept)
|
|
||||||
VALUES (1000.00, 900.00, 2, '2000-01-01', 1106, NULL),
|
INSERT INTO vn.workerIncome
|
||||||
|
(debit, credit, incomeTypeFk, paymentDate, workerFk, concept)
|
||||||
|
VALUES
|
||||||
|
(1000.00, 900.00, 2, '2000-01-01', 1106, NULL),
|
||||||
(1001.00, 800.00, 2, '2000-01-01', 1106, NULL);
|
(1001.00, 800.00, 2, '2000-01-01', 1106, NULL);
|
||||||
|
|
||||||
INSERT INTO dipole.printer (id, description) VALUES(1, '');
|
|
||||||
|
|
||||||
INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode, truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
|
INSERT INTO dipole.printer (id, description)
|
||||||
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
|
VALUES(1, '');
|
||||||
|
|
||||||
INSERT INTO vn.accountDetail (id, value, accountDetailTypeFk, supplierAccountFk)
|
INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode,
|
||||||
VALUES (21, 'ES12345B12345678', 3, 241),
|
truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
|
||||||
(35, 'ES12346B12345679', 3, 241);
|
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
|
||||||
|
|
||||||
INSERT INTO vn.accountDetailType (id, description, code)
|
INSERT INTO vn.accountDetail
|
||||||
VALUES (1, 'IBAN', 'iban'),
|
(id, value, accountDetailTypeFk, supplierAccountFk)
|
||||||
(2, 'SWIFT', 'swift'),
|
VALUES
|
||||||
(3, 'Referencia Remesas', 'remRef'),
|
(21, 'ES12345B12345678', 3, 241),
|
||||||
(4, 'Referencia Transferencias', 'trnRef'),
|
(35, 'ES12346B12345679', 3, 241);
|
||||||
(5, 'Referencia Nominas', 'payRef'),
|
|
||||||
(6, 'ABA', 'aba');
|
INSERT INTO vn.accountDetailType
|
||||||
|
(id, description, code)
|
||||||
|
VALUES
|
||||||
|
(1, 'IBAN', 'iban'),
|
||||||
|
(2, 'SWIFT', 'swift'),
|
||||||
|
(3, 'Referencia Remesas', 'remRef'),
|
||||||
|
(4, 'Referencia Transferencias', 'trnRef'),
|
||||||
|
(5, 'Referencia Nominas', 'payRef'),
|
||||||
|
(6, 'ABA', 'aba');
|
||||||
|
|
||||||
INSERT IGNORE INTO ormConfig
|
INSERT IGNORE INTO ormConfig
|
||||||
SET id =1,
|
SET id =1,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`travel_setDelivered`
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`travel_setDelivered`
|
||||||
ON SCHEDULE EVERY 1 DAY
|
ON SCHEDULE EVERY 1 DAY
|
||||||
STARTS '2024-07-12 00:10:00.000'
|
STARTS '2024-07-12 00:10:00.000'
|
||||||
ON COMPLETION PRESERVE
|
ON COMPLETION PRESERVE
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
|
||||||
vItemFk INT,
|
vItemFk INT,
|
||||||
vWarehouseFk SMALLINT,
|
vWarehouseFk SMALLINT,
|
||||||
vDated DATE
|
vDated DATE
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getUltimateFromInterval`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimateFromInterval`(
|
||||||
vItemFk INT,
|
vItemFk INT,
|
||||||
vWarehouseFk SMALLINT,
|
vWarehouseFk SMALLINT,
|
||||||
vStarted DATE,
|
vStarted DATE,
|
||||||
|
|
|
@ -55,24 +55,20 @@ BEGIN
|
||||||
SELECT ts.saleFk,
|
SELECT ts.saleFk,
|
||||||
ts.itemFk,
|
ts.itemFk,
|
||||||
CAST(0 AS DECIMAL(10,0)) saleOrder,
|
CAST(0 AS DECIMAL(10,0)) saleOrder,
|
||||||
IF(ish.visible > 0 OR iss.id, 1, 100000) *
|
(IF(ish.visible > 0 OR iss.id, 1, 100000) *
|
||||||
IFNULL(p2.pickingOrder, p.pickingOrder) `order`,
|
COALESCE(p2.pickingOrder, p.pickingOrder)) `order`,
|
||||||
TO_SECONDS(IF(iss.id,
|
TO_SECONDS(COALESCE(iss.created, ish.created)) - TO_SECONDS(MAKEDATE(IFNULL(YEAR(iss.created), YEAR(ish.created)), 1)) priority,
|
||||||
iss.created - INTERVAL vCurrentYear YEAR,
|
|
||||||
ish.created - INTERVAL YEAR(ish.created) YEAR)) priority,
|
|
||||||
CONCAT(
|
CONCAT(
|
||||||
IF(iss.id,
|
IF(iss.id, CONCAT('< ', COALESCE(wk.`code`, '---'),' > '), ''),
|
||||||
CONCAT('< ', IFNULL(wk.`code`, '---'),' > '),
|
p.`code`
|
||||||
''),
|
) COLLATE utf8_general_ci placement,
|
||||||
p.`code`) COLLATE utf8_general_ci placement,
|
|
||||||
sh.priority shelvingPriority,
|
sh.priority shelvingPriority,
|
||||||
sh.code COLLATE utf8_general_ci shelving,
|
sh.code COLLATE utf8_general_ci shelving,
|
||||||
ish.created,
|
ish.created,
|
||||||
ish.visible,
|
ish.visible,
|
||||||
IFNULL(
|
COALESCE(
|
||||||
IF(st.code = 'previousByPacking', ish.packing, g.`grouping`),
|
IF(st.code = 'previousByPacking', ish.packing, g.`grouping`),1) `grouping`,
|
||||||
1) `grouping`,
|
(st.code = 'previousPrepared') isPreviousPrepared,
|
||||||
st.code = 'previousPrepared' isPreviousPrepared,
|
|
||||||
iss.id itemShelvingSaleFk,
|
iss.id itemShelvingSaleFk,
|
||||||
ts.ticketFk,
|
ts.ticketFk,
|
||||||
iss.id,
|
iss.id,
|
||||||
|
@ -80,11 +76,12 @@ BEGIN
|
||||||
iss.userFk,
|
iss.userFk,
|
||||||
ts.quantity
|
ts.quantity
|
||||||
FROM tSale ts
|
FROM tSale ts
|
||||||
LEFT JOIN (SELECT DISTINCT saleFk
|
LEFT JOIN (SELECT st.saleFk
|
||||||
FROM saleTracking st
|
FROM saleTracking st
|
||||||
JOIN state s ON s.id = st.stateFk
|
JOIN state s ON s.id = st.stateFk
|
||||||
WHERE st.isChecked
|
WHERE st.isChecked
|
||||||
AND s.semaphore = 1) st ON st.saleFk = ts.saleFk
|
AND s.semaphore = 1
|
||||||
|
GROUP BY st.saleFk) st ON st.saleFk = ts.saleFk
|
||||||
JOIN itemShelving ish ON ish.itemFk = ts.itemFk
|
JOIN itemShelving ish ON ish.itemFk = ts.itemFk
|
||||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||||
JOIN parking p ON p.id = sh.parkingFk
|
JOIN parking p ON p.id = sh.parkingFk
|
||||||
|
@ -93,14 +90,14 @@ BEGIN
|
||||||
JOIN warehouse w ON w.id = sc.warehouseFk
|
JOIN warehouse w ON w.id = sc.warehouseFk
|
||||||
LEFT JOIN tGrouping g ON g.itemFk = ts.itemFk
|
LEFT JOIN tGrouping g ON g.itemFk = ts.itemFk
|
||||||
LEFT JOIN itemShelvingSale iss ON iss.saleFk = ts.saleFk
|
LEFT JOIN itemShelvingSale iss ON iss.saleFk = ts.saleFk
|
||||||
AND iss.itemShelvingFk = ish.id
|
AND iss.itemShelvingFk = ish.id
|
||||||
LEFT JOIN worker wk ON wk.id = iss.userFk
|
LEFT JOIN worker wk ON wk.id = iss.userFk
|
||||||
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = ts.saleFk
|
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = ts.saleFk
|
||||||
LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
|
LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
|
||||||
LEFT JOIN parking p2 ON p2.id = sg.parkingFk
|
LEFT JOIN parking p2 ON p2.id = sg.parkingFk
|
||||||
WHERE w.id = vWarehouseFk
|
WHERE w.id = vWarehouseFk
|
||||||
AND NOT sc.isHideForPickers
|
AND NOT sc.isHideForPickers
|
||||||
HAVING (iss.id AND st.saleFk) OR salePreviousPrepared IS NULL;
|
AND ((iss.id AND st.saleFk) OR st.saleFk IS NULL);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tSalePlacementList2
|
CREATE OR REPLACE TEMPORARY TABLE tSalePlacementList2
|
||||||
(INDEX(saleFk), INDEX(olderPriority))
|
(INDEX(saleFk), INDEX(olderPriority))
|
||||||
|
|
|
@ -23,7 +23,7 @@ BEGIN
|
||||||
JOIN vn.ticketCollection tc ON tc.ticketFk = tob.ticketFk
|
JOIN vn.ticketCollection tc ON tc.ticketFk = tob.ticketFk
|
||||||
LEFT JOIN vn.observationType ot ON ot.id = tob.observationTypeFk
|
LEFT JOIN vn.observationType ot ON ot.id = tob.observationTypeFk
|
||||||
WHERE ot.`code` = 'itemPicker'
|
WHERE ot.`code` = 'itemPicker'
|
||||||
AND tc.collectionFk = vParamFk
|
AND tc.collectionFk = vParamFk OR tc.ticketFk = vParamFk
|
||||||
)
|
)
|
||||||
SELECT t.id ticketFk,
|
SELECT t.id ticketFk,
|
||||||
IF(!(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`,
|
IF(!(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT)
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT)
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vDone BOOL;
|
DECLARE vDone BOOL;
|
||||||
DECLARE vTicketFk INT;
|
DECLARE vTicketFk INT;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemMinimumQuantity_check`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemMinimumQuantity_check`(
|
||||||
vSelf INT,
|
vSelf INT,
|
||||||
vItemFk INT,
|
vItemFk INT,
|
||||||
vStarted DATE,
|
vStarted DATE,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySaleGroup`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySaleGroup`(
|
||||||
vSaleGroupFk INT(11)
|
vSaleGroupFk INT(11)
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getSimilar`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getSimilar`(
|
||||||
vSelf INT,
|
vSelf INT,
|
||||||
vWarehouseFk INT,
|
vWarehouseFk INT,
|
||||||
vDated DATE,
|
vDated DATE,
|
||||||
vShowType BOOL,
|
vShowType BOOL,
|
||||||
vDaysInForward INT
|
vDaysInForward INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
|
@ -17,48 +17,48 @@ BEGIN
|
||||||
* @param vShowType Mostrar tipos
|
* @param vShowType Mostrar tipos
|
||||||
* @param vDaysInForward Días de alcance para las ventas
|
* @param vDaysInForward Días de alcance para las ventas
|
||||||
*/
|
*/
|
||||||
DECLARE vAvailableCalcFk INT;
|
DECLARE vAvailableCalcFk INT;
|
||||||
DECLARE vPriority INT DEFAULT 1;
|
DECLARE vPriority INT DEFAULT 1;
|
||||||
|
|
||||||
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
|
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
|
||||||
|
|
||||||
WITH itemTags AS (
|
WITH itemTags AS (
|
||||||
SELECT i.id,
|
SELECT i.id,
|
||||||
typeFk,
|
typeFk,
|
||||||
tag5,
|
tag5,
|
||||||
value5,
|
value5,
|
||||||
tag6,
|
tag6,
|
||||||
value6,
|
value6,
|
||||||
tag7,
|
tag7,
|
||||||
value7,
|
value7,
|
||||||
tag8,
|
tag8,
|
||||||
value8,
|
value8,
|
||||||
t.name,
|
t.name,
|
||||||
it.value
|
it.value
|
||||||
FROM vn.item i
|
FROM vn.item i
|
||||||
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
|
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
|
||||||
AND it.priority = vPriority
|
AND it.priority = vPriority
|
||||||
LEFT JOIN vn.tag t ON t.id = it.tagFk
|
LEFT JOIN vn.tag t ON t.id = it.tagFk
|
||||||
WHERE i.id = vSelf
|
WHERE i.id = vSelf
|
||||||
),
|
),
|
||||||
stock AS (
|
stock AS (
|
||||||
SELECT itemFk, SUM(visible) stock
|
SELECT itemFk, SUM(visible) stock
|
||||||
FROM vn.itemShelvingStock
|
FROM vn.itemShelvingStock
|
||||||
WHERE warehouseFk = vWarehouseFk
|
WHERE warehouseFk = vWarehouseFk
|
||||||
GROUP BY itemFk
|
GROUP BY itemFk
|
||||||
),
|
),
|
||||||
sold AS (
|
sold AS (
|
||||||
SELECT SUM(s.quantity) quantity, s.itemFk
|
SELECT SUM(s.quantity) quantity, s.itemFk
|
||||||
FROM vn.sale s
|
FROM vn.sale s
|
||||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
|
LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
WHERE t.shipped BETWEEN CURDATE() AND CURDATE() + INTERVAL vDaysInForward DAY
|
WHERE t.shipped >= CURDATE() + INTERVAL vDaysInForward DAY
|
||||||
AND iss.saleFk IS NULL
|
AND iss.saleFk IS NULL
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
GROUP BY s.itemFk
|
GROUP BY s.itemFk
|
||||||
)
|
)
|
||||||
SELECT i.id itemFk,
|
SELECT i.id itemFk,
|
||||||
CAST(sd.quantity AS INT) advanceable,
|
LEAST(CAST(sd.quantity AS INT), sk.stock) advanceable,
|
||||||
i.longName,
|
i.longName,
|
||||||
i.subName,
|
i.subName,
|
||||||
i.tag5,
|
i.tag5,
|
||||||
|
|
|
@ -1,41 +1,47 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`stockBought_calculate`()
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`stockBought_calculate`(
|
||||||
BEGIN
|
vDated DATE
|
||||||
|
)
|
||||||
|
proc: BEGIN
|
||||||
/**
|
/**
|
||||||
* Inserts the purchase volume per buyer
|
* Calculate the stock of the auction warehouse from the inventory date to vDated
|
||||||
* into stockBought according to the current date.
|
* without taking into account the outputs of the same day vDated
|
||||||
|
*
|
||||||
|
* @param vDated Date to calculate the stock.
|
||||||
*/
|
*/
|
||||||
DECLARE vDated DATE;
|
IF vDated < util.VN_CURDATE() THEN
|
||||||
SET vDated = util.VN_CURDATE();
|
LEAVE proc;
|
||||||
|
END IF;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tStockBought
|
CREATE OR REPLACE TEMPORARY TABLE tStockBought
|
||||||
SELECT workerFk, reserve
|
SELECT workerFk, reserve
|
||||||
FROM stockBought
|
FROM stockBought
|
||||||
WHERE dated = vDated
|
WHERE dated = vDated
|
||||||
AND reserve;
|
AND reserve;
|
||||||
|
|
||||||
DELETE FROM stockBought WHERE dated = vDated;
|
DELETE FROM stockBought WHERE dated = vDated;
|
||||||
|
|
||||||
INSERT INTO stockBought (workerFk, bought, dated)
|
CALL item_calculateStock(vDated);
|
||||||
|
|
||||||
|
INSERT INTO stockBought(workerFk, bought, dated)
|
||||||
SELECT it.workerFk,
|
SELECT it.workerFk,
|
||||||
ROUND(SUM(
|
ROUND(SUM(
|
||||||
(ac.conversionCoefficient *
|
(ti.quantity / b.packing) *
|
||||||
(b.quantity / b.packing) *
|
|
||||||
buy_getVolume(b.id)
|
buy_getVolume(b.id)
|
||||||
) / (vc.trolleyM3 * 1000000)
|
) / vc.palletM3 / 1000000, 1) bought,
|
||||||
), 1),
|
|
||||||
vDated
|
vDated
|
||||||
FROM entry e
|
FROM itemType it
|
||||||
JOIN travel t ON t.id = e.travelFk
|
JOIN item i ON i.typeFk = it.id
|
||||||
JOIN warehouse w ON w.id = t.warehouseInFk
|
LEFT JOIN tmp.item ti ON ti.itemFk = i.id
|
||||||
JOIN buy b ON b.entryFk = e.id
|
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
JOIN item i ON i.id = b.itemFk
|
JOIN warehouse wh ON wh.code = 'VNH'
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
|
||||||
JOIN auctionConfig ac
|
AND bu.warehouseFk = wh.id
|
||||||
|
JOIN buy b ON b.id = bu.buyFk
|
||||||
JOIN volumeConfig vc
|
JOIN volumeConfig vc
|
||||||
WHERE t.shipped = vDated
|
WHERE ic.display
|
||||||
AND t.warehouseInFk = ac.warehouseFk
|
GROUP BY it.workerFk
|
||||||
GROUP BY it.workerFk;
|
HAVING bought;
|
||||||
|
|
||||||
UPDATE stockBought s
|
UPDATE stockBought s
|
||||||
JOIN tStockBought ts ON ts.workerFk = s.workerFk
|
JOIN tStockBought ts ON ts.workerFk = s.workerFk
|
||||||
|
@ -45,8 +51,12 @@ BEGIN
|
||||||
INSERT INTO stockBought (workerFk, reserve, dated)
|
INSERT INTO stockBought (workerFk, reserve, dated)
|
||||||
SELECT ts.workerFk, ts.reserve, vDated
|
SELECT ts.workerFk, ts.reserve, vDated
|
||||||
FROM tStockBought ts
|
FROM tStockBought ts
|
||||||
WHERE ts.workerFk NOT IN (SELECT workerFk FROM stockBought WHERE dated = vDated);
|
WHERE ts.workerFk NOT IN (
|
||||||
|
SELECT workerFk
|
||||||
|
FROM stockBought
|
||||||
|
WHERE dated = vDated
|
||||||
|
);
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tStockBought;
|
DROP TEMPORARY TABLE tStockBought, tmp.item, tmp.buyUltimate;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE vn.supplier_statementWithEntries(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE vn.supplier_statementWithEntries(
|
||||||
vSupplierFk INT,
|
vSupplierFk INT,
|
||||||
vCurrencyFk INT,
|
vCurrencyFk INT,
|
||||||
vCompanyFk INT,
|
vCompanyFk INT,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_mergeSales`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_mergeSales`(
|
||||||
vSelf INT
|
vSelf INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRiskByClient`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setProblemRiskByClient`(
|
||||||
vClientFk INT
|
vClientFk INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setVolume`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setVolume`(
|
||||||
vSelf INT
|
vSelf INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setVolumeItemCost`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setVolumeItemCost`(
|
||||||
vItemFk INT
|
vItemFk INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`host_beforeInsert`
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`host_beforeInsert`
|
||||||
BEFORE INSERT ON `host`
|
BEFORE INSERT ON `host`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_afterInsert`
|
||||||
|
AFTER INSERT ON `itemShelving`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO itemShelvingLog
|
||||||
|
SET itemShelvingFk = NEW.id,
|
||||||
|
workerFk = account.myUser_getId(),
|
||||||
|
accion = 'CREA REGISTRO',
|
||||||
|
itemFk = NEW.itemFk,
|
||||||
|
shelvingFk = NEW.shelvingFk,
|
||||||
|
visible = NEW.visible,
|
||||||
|
`grouping` = NEW.`grouping`,
|
||||||
|
packing = NEW.packing,
|
||||||
|
available = NEW.available;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`roadmap_beforeInsert`
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeInsert`
|
||||||
BEFORE INSERT ON `roadmap`
|
BEFORE INSERT ON `roadmap`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate`
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate`
|
||||||
BEFORE UPDATE ON `roadmap`
|
BEFORE UPDATE ON `roadmap`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeInsert`
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeInsert`
|
||||||
BEFORE INSERT ON `saleGroupDetail`
|
BEFORE INSERT ON `saleGroupDetail`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_afterDelete`
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroupDetail_afterDelete`
|
||||||
AFTER DELETE ON `saleGroupDetail`
|
AFTER DELETE ON `saleGroupDetail`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeUpdate`
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeUpdate`
|
||||||
BEFORE UPDATE ON `saleGroupDetail`
|
BEFORE UPDATE ON `saleGroupDetail`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -2,12 +2,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost`
|
||||||
SQL SECURITY DEFINER
|
SQL SECURITY DEFINER
|
||||||
VIEW `vn`.`buyer`
|
VIEW `vn`.`buyer`
|
||||||
AS SELECT DISTINCT `u`.`id` AS `userFk`,
|
AS SELECT DISTINCT `u`.`id` AS `userFk`,
|
||||||
`u`.`nickname` AS `nickname`,
|
`u`.`nickname` AS `nickname`
|
||||||
`ic`.`display` AS `display`
|
|
||||||
FROM (
|
FROM (
|
||||||
`account`.`user` `u`
|
`account`.`user` `u`
|
||||||
JOIN `vn`.`itemType` `it` ON(`it`.`workerFk` = `u`.`id`)
|
JOIN `vn`.`itemType` `it` ON(`it`.`workerFk` = `u`.`id`)
|
||||||
JOIN `vn`.`itemCategory` `ic` ON(`ic`.`id` = `it`.`categoryFk`)
|
|
||||||
)
|
)
|
||||||
WHERE `u`.`active` <> 0
|
WHERE `u`.`active` <> 0
|
||||||
ORDER BY `u`.`nickname`
|
ORDER BY `u`.`nickname`
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
-- vn.priceDelta definition
|
||||||
|
|
||||||
|
CREATE OR REPLACE TABLE vn.priceDelta (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`itemTypeFk` smallint(5) unsigned NOT NULL,
|
||||||
|
`minSize` int(10) unsigned DEFAULT NULL COMMENT 'Minimum item.size',
|
||||||
|
`maxSize` int(10) unsigned DEFAULT NULL COMMENT 'Maximum item.size',
|
||||||
|
`inkFk` varchar(3) DEFAULT NULL,
|
||||||
|
`originFk` tinyint(2) unsigned DEFAULT NULL,
|
||||||
|
`producerFk` mediumint(3) unsigned DEFAULT NULL,
|
||||||
|
`fromDated` date DEFAULT NULL,
|
||||||
|
`toDated` date DEFAULT NULL,
|
||||||
|
`absIncreasing` decimal(10,3) DEFAULT NULL COMMENT 'Absolute increasing of final price',
|
||||||
|
`ratIncreasing` int(11) DEFAULT NULL COMMENT 'Increasing ratio for the cost price',
|
||||||
|
`warehouseFk` smallint(6) unsigned NOT NULL,
|
||||||
|
`created` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||||
|
`editorFk` int(10) unsigned DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `priceDelta_itemType_FK` (`itemTypeFk`),
|
||||||
|
KEY `priceDelta_ink_FK` (`inkFk`),
|
||||||
|
KEY `priceDelta_producer_FK` (`producerFk`),
|
||||||
|
KEY `priceDelta_warehouse_FK` (`warehouseFk`),
|
||||||
|
KEY `priceDelta_worker_FK` (`editorFk`),
|
||||||
|
CONSTRAINT `priceDelta_ink_FK` FOREIGN KEY (`inkFk`) REFERENCES `ink` (`id`) ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `priceDelta_itemType_FK` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `priceDelta_producer_FK` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `priceDelta_warehouse_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `priceDelta_worker_FK` FOREIGN KEY (`editorFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Defines the increasing o decreasing for ranges of items';
|
||||||
|
|
||||||
|
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE vn.priceDelta TO buyer;
|
|
@ -57,7 +57,7 @@ export default class App {
|
||||||
|
|
||||||
getUrl(route, appName = 'lilium') {
|
getUrl(route, appName = 'lilium') {
|
||||||
const index = window.location.hash.indexOf(route.toLowerCase());
|
const index = window.location.hash.indexOf(route.toLowerCase());
|
||||||
const newRoute = index < 0 ? route : window.location.hash.substring(index);
|
let newRoute = index < 0 ? route : window.location.hash.substring(index);
|
||||||
const env = process.env.NODE_ENV;
|
const env = process.env.NODE_ENV;
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {and: [
|
where: {and: [
|
||||||
|
@ -66,6 +66,11 @@ export default class App {
|
||||||
]}
|
]}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
if (this.logger.$params.q)
|
||||||
|
newRoute = newRoute.concat(`?table=${this.logger.$params.q}`);
|
||||||
|
|
||||||
|
|
||||||
return this.logger.$http.get('Urls/findOne', {filter})
|
return this.logger.$http.get('Urls/findOne', {filter})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res && res.data)
|
if (res && res.data)
|
||||||
|
|
|
@ -235,10 +235,10 @@
|
||||||
"Cannot add holidays on this day": "Cannot add holidays on this day",
|
"Cannot add holidays on this day": "Cannot add holidays on this day",
|
||||||
"Cannot send mail": "Cannot send mail",
|
"Cannot send mail": "Cannot send mail",
|
||||||
"CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`": "CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`",
|
"CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`": "CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`",
|
||||||
|
"This postcode already exists": "This postcode already exists",
|
||||||
"Original invoice not found": "Original invoice not found",
|
"Original invoice not found": "Original invoice not found",
|
||||||
"There is already a tray with the same height": "There is already a tray with the same height",
|
"There is already a tray with the same height": "There is already a tray with the same height",
|
||||||
"The height must be greater than 50cm": "The height must be greater than 50cm",
|
"The height must be greater than 50cm": "The height must be greater than 50cm",
|
||||||
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
|
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
|
||||||
"This postcode already exists": "This postcode already exists",
|
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line"
|
||||||
"This buyer has already made a reservation for this date": "This buyer has already made a reservation for this date"
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -366,9 +366,11 @@
|
||||||
"The invoices have been created but the PDFs could not be generated": "Se ha facturado pero no se ha podido generar el PDF",
|
"The invoices have been created but the PDFs could not be generated": "Se ha facturado pero no se ha podido generar el PDF",
|
||||||
"It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono",
|
"It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono",
|
||||||
"Payment method is required": "El método de pago es obligatorio",
|
"Payment method is required": "El método de pago es obligatorio",
|
||||||
"Cannot send mail": "No se ha podido enviar el correo",
|
"Cannot send mail": "Não é possível enviar o email",
|
||||||
"CONSTRAINT `supplierAccountTooShort` failed for `vn`.`supplier`": "La cuenta debe tener exactamente 10 dígitos",
|
"CONSTRAINT `supplierAccountTooShort` failed for `vn`.`supplier`": "La cuenta debe tener exactamente 10 dígitos",
|
||||||
"The sale not exists in the item shelving": "La venta no existe en la estantería del artículo",
|
"The sale not exists in the item shelving": "La venta no existe en la estantería del artículo",
|
||||||
|
"The entry not have stickers": "La entrada no tiene etiquetas",
|
||||||
|
"Too many records": "Demasiados registros",
|
||||||
"Original invoice not found": "Factura original no encontrada",
|
"Original invoice not found": "Factura original no encontrada",
|
||||||
"The entry has no lines or does not exist": "La entrada no tiene lineas o no existe",
|
"The entry has no lines or does not exist": "La entrada no tiene lineas o no existe",
|
||||||
"Weight already set": "El peso ya está establecido",
|
"Weight already set": "El peso ya está establecido",
|
||||||
|
@ -376,7 +378,5 @@
|
||||||
"There is already a tray with the same height": "Ya existe una bandeja con la misma altura",
|
"There is already a tray with the same height": "Ya existe una bandeja con la misma altura",
|
||||||
"The height must be greater than 50cm": "La altura debe ser superior a 50cm",
|
"The height must be greater than 50cm": "La altura debe ser superior a 50cm",
|
||||||
"The maximum height of the wagon is 200cm": "La altura máxima es 200cm",
|
"The maximum height of the wagon is 200cm": "La altura máxima es 200cm",
|
||||||
"The entry does not have stickers": "La entrada no tiene etiquetas",
|
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea"
|
||||||
"Too many records": "Demasiados registros",
|
|
||||||
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,6 +361,6 @@
|
||||||
"The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
|
"The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
|
||||||
"It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré",
|
"It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré",
|
||||||
"Cannot send mail": "Impossible d'envoyer le mail",
|
"Cannot send mail": "Impossible d'envoyer le mail",
|
||||||
"Original invoice not found": "Facture originale introuvable"
|
"Original invoice not found": "Facture originale introuvable",
|
||||||
|
"The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne"
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,5 +361,6 @@
|
||||||
"The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado",
|
"The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado",
|
||||||
"It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso",
|
"It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso",
|
||||||
"Original invoice not found": "Fatura original não encontrada",
|
"Original invoice not found": "Fatura original não encontrada",
|
||||||
"Cannot send mail": "Não é possível enviar o email"
|
"Cannot send mail": "Não é possível enviar o email",
|
||||||
|
"The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
const ForbiddenError = require('vn-loopback/util/forbiddenError');
|
const ForbiddenError = require('vn-loopback/util/forbiddenError');
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.rewriteDbError(function(err) {
|
Self.rewriteDbError(function(err) {
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
|
describe('ClaimBeginning model()', () => {
|
||||||
|
const claimFk = 1;
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 18},
|
||||||
|
headers: {origin: 'localhost:5000'},
|
||||||
|
__: () => {}
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should change quantity claimed', async() => {
|
||||||
|
const tx = await models.ClaimBeginning.beginTransaction({});
|
||||||
|
|
||||||
|
let error;
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const claim = await models.ClaimBeginning.findOne({where: {claimFk}}, options);
|
||||||
|
const sale = await models.Sale.findById(claim.saleFk, {}, options);
|
||||||
|
await claim.updateAttribute('quantity', sale.quantity - 1, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw error when quantity claimed is greater than quantity of the sale', async() => {
|
||||||
|
const tx = await models.ClaimBeginning.beginTransaction({});
|
||||||
|
|
||||||
|
let error;
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const claim = await models.ClaimBeginning.findOne({where: {claimFk}}, options);
|
||||||
|
const sale = await models.Sale.findById(claim.saleFk, {}, options);
|
||||||
|
await claim.updateAttribute('quantity', sale.quantity + 1, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.toString()).toContain('The quantity claimed cannot be greater than the quantity of the line');
|
||||||
|
});
|
||||||
|
});
|
|
@ -10,16 +10,21 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.observe('before save', async ctx => {
|
Self.observe('before save', async ctx => {
|
||||||
|
const options = ctx.options;
|
||||||
|
const models = Self.app.models;
|
||||||
|
const saleFk = ctx?.currentInstance?.saleFk || ctx?.instance?.saleFk;
|
||||||
|
const sale = await models.Sale.findById(saleFk, {fields: ['ticketFk', 'quantity']}, options);
|
||||||
|
|
||||||
if (ctx.isNewInstance) {
|
if (ctx.isNewInstance) {
|
||||||
const models = Self.app.models;
|
const claim = await models.Claim.findById(ctx.instance.claimFk, {fields: ['ticketFk']}, options);
|
||||||
const options = ctx.options;
|
if (sale.ticketFk != claim.ticketFk)
|
||||||
const instance = ctx.instance;
|
|
||||||
const ticket = await models.Sale.findById(instance.saleFk, {fields: ['ticketFk']}, options);
|
|
||||||
const claim = await models.Claim.findById(instance.claimFk, {fields: ['ticketFk']}, options);
|
|
||||||
if (ticket.ticketFk != claim.ticketFk)
|
|
||||||
throw new UserError(`Cannot create a new claimBeginning from a different ticket`);
|
throw new UserError(`Cannot create a new claimBeginning from a different ticket`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await claimIsEditable(ctx);
|
await claimIsEditable(ctx);
|
||||||
|
|
||||||
|
if (sale?.quantity && ctx.data?.quantity && ctx.data.quantity > sale?.quantity)
|
||||||
|
throw new UserError('The quantity claimed cannot be greater than the quantity of the line');
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.observe('before delete', async ctx => {
|
Self.observe('before delete', async ctx => {
|
||||||
|
|
|
@ -52,7 +52,7 @@ module.exports = Self => {
|
||||||
await merger.add(new Uint8Array(pdfBuffer[0]));
|
await merger.add(new Uint8Array(pdfBuffer[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!merger._doc) throw new UserError('The entry does not have stickers');
|
if (!merger._doc) throw new UserError('The entry not have stickers');
|
||||||
|
|
||||||
await Self.rawSql(`
|
await Self.rawSql(`
|
||||||
UPDATE buy
|
UPDATE buy
|
||||||
|
|
|
@ -39,7 +39,7 @@ describe('Entry filter()', () => {
|
||||||
|
|
||||||
const result = await models.Entry.filter(ctx, options);
|
const result = await models.Entry.filter(ctx, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(12);
|
expect(result.length).toEqual(11);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -131,7 +131,7 @@ describe('Entry filter()', () => {
|
||||||
|
|
||||||
const result = await models.Entry.filter(ctx, options);
|
const result = await models.Entry.filter(ctx, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(11);
|
expect(result.length).toEqual(10);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -29,15 +29,13 @@ module.exports = Self => {
|
||||||
dated.setHours(0, 0, 0, 0);
|
dated.setHours(0, 0, 0, 0);
|
||||||
today.setHours(0, 0, 0, 0);
|
today.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
if (dated.getTime() === today.getTime())
|
await models.StockBought.rawSql(`CALL vn.stockBought_calculate(?)`, [dated]);
|
||||||
await models.StockBought.rawSql(`CALL vn.stockBought_calculate()`);
|
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {
|
where: {dated},
|
||||||
dated: dated
|
|
||||||
},
|
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
fields: ['workerFk', 'reserve', 'bought'],
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
include: [
|
include: [
|
||||||
|
|
|
@ -11,6 +11,7 @@ module.exports = Self => {
|
||||||
arg: 'dated',
|
arg: 'dated',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'The date to filter',
|
description: 'The date to filter',
|
||||||
|
required: true,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
|
@ -24,35 +25,50 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.getStockBoughtDetail = async(workerFk, dated) => {
|
Self.getStockBoughtDetail = async(workerFk, dated) => {
|
||||||
if (!dated) {
|
const models = Self.app.models;
|
||||||
dated = Date.vnNew();
|
const myOptions = {};
|
||||||
dated.setHours(0, 0, 0, 0);
|
let tx;
|
||||||
|
let result;
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
if (!myOptions.transaction) {
|
||||||
|
tx = await Self.beginTransaction({});
|
||||||
|
myOptions.transaction = tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await models.StockBought.rawSql(`CALL vn.item_calculateStock(?)`, [dated], myOptions);
|
||||||
|
result = await Self.rawSql(
|
||||||
|
`SELECT b.entryFk entryFk,
|
||||||
|
i.id itemFk,
|
||||||
|
i.name itemName,
|
||||||
|
ti.quantity,
|
||||||
|
(ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id))
|
||||||
|
/ (vc.trolleyM3 * 1000000) volume,
|
||||||
|
b.packagingFk packagingFk,
|
||||||
|
b.packing
|
||||||
|
FROM tmp.item ti
|
||||||
|
JOIN item i ON i.id = ti.itemFk
|
||||||
|
JOIN itemType it ON i.typeFk = it.id
|
||||||
|
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
|
JOIN worker w ON w.id = it.workerFk
|
||||||
|
JOIN auctionConfig ac
|
||||||
|
JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
|
||||||
|
AND bu.warehouseFk = ac.warehouseFk
|
||||||
|
JOIN buy b ON b.id = bu.buyFk
|
||||||
|
JOIN volumeConfig vc
|
||||||
|
WHERE ic.display
|
||||||
|
AND w.id = ?`,
|
||||||
|
[workerFk], myOptions
|
||||||
|
);
|
||||||
|
await Self.rawSql(`DROP TEMPORARY TABLE tmp.item, tmp.buyUltimate;`, [], myOptions);
|
||||||
|
if (tx) await tx.commit();
|
||||||
|
return result;
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
return Self.rawSql(
|
|
||||||
`SELECT e.id entryFk,
|
|
||||||
i.id itemFk,
|
|
||||||
i.longName itemName,
|
|
||||||
b.quantity,
|
|
||||||
ROUND((ac.conversionCoefficient *
|
|
||||||
(b.quantity / b.packing) *
|
|
||||||
buy_getVolume(b.id)
|
|
||||||
) / (vc.trolleyM3 * 1000000),
|
|
||||||
2
|
|
||||||
) volume,
|
|
||||||
b.packagingFk,
|
|
||||||
b.packing
|
|
||||||
FROM entry e
|
|
||||||
JOIN travel t ON t.id = e.travelFk
|
|
||||||
JOIN buy b ON b.entryFk = e.id
|
|
||||||
JOIN item i ON i.id = b.itemFk
|
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
|
||||||
JOIN worker w ON w.id = it.workerFk
|
|
||||||
JOIN auctionConfig ac
|
|
||||||
JOIN volumeConfig vc
|
|
||||||
WHERE t.warehouseInFk = ac.warehouseFk
|
|
||||||
AND it.workerFk = ?
|
|
||||||
AND t.shipped = util.VN_CURDATE()`,
|
|
||||||
[workerFk]
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,4 +29,4 @@
|
||||||
"StockBought": {
|
"StockBought": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
const client = await models.Client.findById(args.clientId, {
|
const client = await models.Client.findById(args.clientId, {
|
||||||
fields: ['id', 'hasToInvoiceByAddress']
|
fields: ['id', 'hasToInvoiceByAddress']
|
||||||
}, options);
|
}, myOptions);
|
||||||
|
|
||||||
if (client.hasToInvoiceByAddress) {
|
if (client.hasToInvoiceByAddress) {
|
||||||
await Self.rawSql('CALL ticketToInvoiceByAddress(?, ?, ?, ?)', [
|
await Self.rawSql('CALL ticketToInvoiceByAddress(?, ?, ?, ?)', [
|
||||||
|
@ -72,13 +72,13 @@ module.exports = Self => {
|
||||||
args.maxShipped,
|
args.maxShipped,
|
||||||
args.addressId,
|
args.addressId,
|
||||||
args.companyFk
|
args.companyFk
|
||||||
], options);
|
], myOptions);
|
||||||
} else {
|
} else {
|
||||||
await Self.rawSql('CALL invoiceFromClient(?, ?, ?)', [
|
await Self.rawSql('CALL invoiceFromClient(?, ?, ?)', [
|
||||||
args.maxShipped,
|
args.maxShipped,
|
||||||
client.id,
|
client.id,
|
||||||
args.companyFk
|
args.companyFk
|
||||||
], options);
|
], myOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
const invoiceId = await models.Ticket.makeInvoice(
|
const invoiceId = await models.Ticket.makeInvoice(
|
||||||
|
@ -87,7 +87,7 @@ module.exports = Self => {
|
||||||
args.companyFk,
|
args.companyFk,
|
||||||
args.invoiceDate,
|
args.invoiceDate,
|
||||||
null,
|
null,
|
||||||
options
|
myOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
|
@ -38,9 +38,13 @@ module.exports = Self => {
|
||||||
|
|
||||||
const itemShelving = itemShelvingSale.itemShelving();
|
const itemShelving = itemShelvingSale.itemShelving();
|
||||||
const quantity = itemShelving.visible + itemShelvingSale.quantity;
|
const quantity = itemShelving.visible + itemShelvingSale.quantity;
|
||||||
|
const available = itemShelving.available + itemShelvingSale.quantity;
|
||||||
|
|
||||||
await itemShelving.updateAttributes(
|
await itemShelving.updateAttributes(
|
||||||
{visible: quantity},
|
{
|
||||||
|
visible: quantity,
|
||||||
|
available: available
|
||||||
|
},
|
||||||
myOptions
|
myOptions
|
||||||
);
|
);
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
|
@ -75,7 +75,11 @@ module.exports = Self => {
|
||||||
|
|
||||||
const itemShelving = await models.ItemShelving.findById(itemShelvingFk, null, myOptions);
|
const itemShelving = await models.ItemShelving.findById(itemShelvingFk, null, myOptions);
|
||||||
|
|
||||||
await itemShelving.updateAttributes({visible: itemShelving.visible - quantity}, myOptions);
|
await itemShelving.updateAttributes(
|
||||||
|
{
|
||||||
|
visible: itemShelving.visible - quantity,
|
||||||
|
available: itemShelving.available - quantity
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
await Self.updateAll(
|
await Self.updateAll(
|
||||||
{saleFk},
|
{saleFk},
|
||||||
|
|
|
@ -142,12 +142,19 @@ module.exports = Self => {
|
||||||
ctx.args.addressId = ticket.addressFk;
|
ctx.args.addressId = ticket.addressFk;
|
||||||
|
|
||||||
const newTicket = await models.Ticket.new(ctx, myOptions);
|
const newTicket = await models.Ticket.new(ctx, myOptions);
|
||||||
|
const existingRefund = await models.TicketRefund.findOne({
|
||||||
await models.TicketRefund.create({
|
where: {
|
||||||
originalTicketFk: ticketId,
|
originalTicketFk: ticketId,
|
||||||
refundTicketFk: newTicket.id
|
refundTicketFk: newTicket.id
|
||||||
}, myOptions);
|
},
|
||||||
|
myOptions
|
||||||
|
});
|
||||||
|
if (!existingRefund) {
|
||||||
|
await models.TicketRefund.create({
|
||||||
|
originalTicketFk: ticketId,
|
||||||
|
refundTicketFk: newTicket.id
|
||||||
|
}, myOptions);
|
||||||
|
}
|
||||||
return newTicket;
|
return newTicket;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -82,7 +82,7 @@ module.exports = Self => {
|
||||||
const getDataOperator = await models.Operator.findOne({
|
const getDataOperator = await models.Operator.findOne({
|
||||||
where: {workerFk: user.id},
|
where: {workerFk: user.id},
|
||||||
fields: ['numberOfWagons', 'warehouseFk', 'itemPackingTypeFk', 'sectorFk', 'sector',
|
fields: ['numberOfWagons', 'warehouseFk', 'itemPackingTypeFk', 'sectorFk', 'sector',
|
||||||
'trainFk', 'train', 'labelerFk', 'printer'],
|
'trainFk', 'train', 'labelerFk', 'printer', 'isOnReservationMode'],
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
relation: 'sector',
|
relation: 'sector',
|
||||||
|
|
Loading…
Reference in New Issue