4515-itemWeight #1971
|
@ -0,0 +1,49 @@
|
|||
-- algunas medias se quedan muy fuera de lugar
|
||||
UPDATE `vn`.`item` i
|
||||
JOIN(
|
||||
SELECT typeFk, AVG(`size`) `size`
|
||||
FROM vn.item
|
||||
WHERE `size` > 0
|
||||
AND `size` IS NOT NULL
|
||||
GROUP BY typeFk
|
||||
) sub ON sub.typeFk = i.typeFk
|
||||
SET i.`size` = CAST(sub.`size` AS SIGNED)
|
||||
WHERE i.`size` IS NULL;
|
||||
|
||||
ALTER TABLE `vn`.`item` MODIFY COLUMN `size` int(10) NOT NULL;
|
||||
|
||||
UPDATE `vn`.`item` i
|
||||
JOIN(
|
||||
SELECT typeFk, AVG(weightByPiece / `size`) grams
|
||||
FROM vn.item
|
||||
WHERE weightByPiece IS NOT NULL
|
||||
AND weightByPiece > 0
|
||||
AND `size` > 0
|
||||
AND `size` IS NOT NULL
|
||||
GROUP BY typeFk
|
||||
) sub ON sub.typeFk = i.typeFk
|
||||
SET i.weightByPiece = CAST(sub.grams * `size` AS SIGNED)
|
||||
WHERE weightByPiece IS NULL
|
||||
OR weightByPiece = 0;
|
||||
|
||||
ALTER TABLE `vn`.`item`
|
||||
MODIFY COLUMN weightByPiece int(10) NOT NULL
|
||||
COMMENT 'peso por defecto para un articulo por tallo/unidad';
|
||||
|
||||
-- revisar algunos se quedan fuera
|
||||
|
||||
UPDATE `vn`.`buy` b
|
||||
SET b.packing = IFNULL(b.grouping, 0) * 2
|
||||
WHERE b.packing IS NULL;
|
||||
|
||||
ALTER TABLE `vn`.`buy`
|
||||
MODIFY COLUMN packing int(11)
|
||||
DEFAULT 0 NOT NULL;
|
||||
|
||||
UPDATE `vn`.`buy` b
|
||||
JOIN `vn`.`item` i ON i.id = b.itemFk
|
||||
SET b.weight = (i.weightByPiece * b.packing) / 1000
|
||||
WHERE weight IS NULL
|
||||
OR weight = 0;
|
||||
|
||||
ALTER TABLE `vn`.`buy` MODIFY COLUMN `weight` decimal(10,2) NOT NULL;
|
|
@ -926,20 +926,20 @@ INSERT INTO `vn`.`item`(`id`, `typeFk`, `stems`, `originFk`, `description`, `pro
|
|||
(1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'EMB', 0, NULL, 'V', 0, 15,3),
|
||||
(2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10,2),
|
||||
(3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5,5),
|
||||
(4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||
(5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||
(6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||
(7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||
(8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||
(9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
|
||||
(10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||
(11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||
(12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||
(13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL,NULL),
|
||||
(14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
|
||||
(15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
|
||||
(16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
|
||||
(71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL);
|
||||
(4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,0),
|
||||
(5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,0),
|
||||
(6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,0),
|
||||
(7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,0),
|
||||
(8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL,0),
|
||||
(9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,0),
|
||||
(10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,0),
|
||||
(11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,0),
|
||||
(12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,0),
|
||||
(13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL,0),
|
||||
(14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,0),
|
||||
(15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,0),
|
||||
(16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,0),
|
||||
(71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL,0);
|
||||
|
||||
-- Update the taxClass after insert of the items
|
||||
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2
|
||||
|
|
|
@ -38,6 +38,8 @@ module.exports = Self => {
|
|||
'intrastatFk',
|
||||
'originFk',
|
||||
'priority',
|
||||
'weightByPiece',
|
||||
'size',
|
||||
'tag'
|
||||
];
|
||||
|
||||
|
|
|
@ -37,6 +37,18 @@
|
|||
value-field="priority"
|
||||
vn-name="priority">
|
||||
</vn-autocomplete>
|
||||
<vn-input-number
|
||||
type="number"
|
||||
label="Weight/Piece"
|
||||
ng-model="$ctrl.item.weightByPiece"
|
||||
rule>
|
||||
</vn-input-number>
|
||||
<vn-input-number
|
||||
type="number"
|
||||
label="Size"
|
||||
ng-model="$ctrl.item.size"
|
||||
rule>
|
||||
</vn-input-number>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
|
|
Loading…
Reference in New Issue