feat: refs #7266 Requested changes and query optimization
This commit is contained in:
parent
b1a295dca4
commit
4c529da620
|
@ -1,7 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getUltimate`(
|
||||
vItemFk INT,
|
||||
vWarehouseFk SMALLINT,
|
||||
vWarehouseFk INT,
|
||||
vDated DATE
|
||||
)
|
||||
RETURNS int(11)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
|
||||
vItemFk INT,
|
||||
vWarehouseFk SMALLINT,
|
||||
vWarehouseFk INT,
|
||||
vDated DATE
|
||||
)
|
||||
BEGIN
|
||||
|
|
|
@ -17,12 +17,16 @@
|
|||
<tr>
|
||||
<td class="right lg-width">
|
||||
<div class="overflow-line">
|
||||
{{item.comment}}
|
||||
{{
|
||||
(item.longName && item.size && item.subName)
|
||||
? `${item.longName} ${item.size} ${item.subName}`
|
||||
: item.comment
|
||||
}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="center sm-width">
|
||||
<div class="overflow-line">
|
||||
{{item.producer}}
|
||||
{{item.producerName || item.producerFk}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="center sm-width">
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
SELECT co.code
|
||||
FROM warehouse w
|
||||
JOIN address a ON a.id = w.addressFk
|
||||
JOIN client c ON c.id = a.clientFk
|
||||
JOIN company co ON co.clientFk = c.id
|
||||
JOIN company co ON co.clientFk = a.clientFk
|
||||
WHERE w.id = ?
|
|
@ -6,37 +6,29 @@ WITH RECURSIVE numbers AS (
|
|||
WHERE n < ?
|
||||
)
|
||||
SELECT ROW_NUMBER() OVER() labelNum,
|
||||
b.id buyFk,
|
||||
b.itemFk,
|
||||
b.quantity,
|
||||
b.packing,
|
||||
b.isPickedOff,
|
||||
b.entryFk,
|
||||
e.sub,
|
||||
o.code origin,
|
||||
COALESCE(p.`name`, p.id, '') producer,
|
||||
i.name item,
|
||||
i.`size`,
|
||||
i.category,
|
||||
i.stems,
|
||||
i.inkFk,
|
||||
IFNULL(CONCAT(ig.longName, ' ', ig.`size`, ' ', ig.subName), i.comment) comment,
|
||||
i.typeFk,
|
||||
i.isLaid,
|
||||
w.code buyerName,
|
||||
w.code,
|
||||
s.company_name companyName,
|
||||
t.shipped
|
||||
FROM vn.buy b
|
||||
JOIN vn.item i ON i.id = b.itemFk
|
||||
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
||||
LEFT JOIN edi.ekt e ON e.id = b.ektFk
|
||||
JOIN vn.origin o ON o.id = i.originFk
|
||||
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN vn.worker w ON w.id = it.workerFk
|
||||
LEFT JOIN edi.supplier s ON s.supplier_id = e.pro
|
||||
JOIN vn.entry e2 ON e2.id = b.entryFk
|
||||
JOIN vn.travel t ON t.id = e2.travelFk
|
||||
JOIN numbers num
|
||||
WHERE b.id = ?
|
||||
b.itemFk,
|
||||
i.name item,
|
||||
b.id buyFk,
|
||||
b.quantity,
|
||||
b.packing,
|
||||
b.entryFk,
|
||||
o.code origin,
|
||||
p.`name` producerName,
|
||||
p.id producerFk,
|
||||
i.`size`,
|
||||
i.category,
|
||||
i.stems,
|
||||
i.inkFk,
|
||||
ig.longName,
|
||||
ig.subName,
|
||||
i.comment,
|
||||
w.code buyerName
|
||||
FROM vn.buy b
|
||||
JOIN vn.item i ON i.id = b.itemFk
|
||||
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
||||
JOIN vn.origin o ON o.id = i.originFk
|
||||
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN vn.worker w ON w.id = it.workerFk
|
||||
JOIN numbers num
|
||||
WHERE b.id = ?
|
|
@ -71,7 +71,7 @@
|
|||
<tr>
|
||||
<td colspan="2" class="md-width">
|
||||
<div class="overflow-line">
|
||||
<i>Productor:</i> {{item.producer}}
|
||||
<i>Productor:</i> {{item.producerName || item.producerFk}}
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
|
@ -103,7 +103,11 @@
|
|||
<tr>
|
||||
<td colspan="3" class="lg-width center cursive bold">
|
||||
<div class="overflow-line">
|
||||
{{item.comment}}
|
||||
{{
|
||||
(item.longName && item.size && item.subName)
|
||||
? `${item.longName} ${item.size} ${item.subName}`
|
||||
: item.comment
|
||||
}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
SELECT co.code
|
||||
FROM warehouse w
|
||||
JOIN address a ON a.id = w.addressFk
|
||||
JOIN client c ON c.id = a.clientFk
|
||||
JOIN company co ON co.clientFk = c.id
|
||||
JOIN company co ON co.clientFk = a.clientFk
|
||||
WHERE w.id = ?
|
|
@ -6,37 +6,29 @@ WITH RECURSIVE numbers AS (
|
|||
WHERE n < ?
|
||||
)
|
||||
SELECT ROW_NUMBER() OVER() labelNum,
|
||||
b.id buyFk,
|
||||
b.itemFk,
|
||||
b.quantity,
|
||||
b.packing,
|
||||
b.isPickedOff,
|
||||
b.entryFk,
|
||||
e.sub,
|
||||
o.code origin,
|
||||
COALESCE(p.`name`, p.id, '') producer,
|
||||
i.name item,
|
||||
i.`size`,
|
||||
i.category,
|
||||
i.stems,
|
||||
i.inkFk,
|
||||
IFNULL(CONCAT(ig.longName, ' ', ig.`size`, ' ', ig.subName), i.comment) comment,
|
||||
i.typeFk,
|
||||
i.isLaid,
|
||||
w.code buyerName,
|
||||
w.code,
|
||||
s.company_name companyName,
|
||||
t.shipped
|
||||
FROM vn.buy b
|
||||
JOIN vn.item i ON i.id = b.itemFk
|
||||
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
||||
LEFT JOIN edi.ekt e ON e.id = b.ektFk
|
||||
JOIN vn.origin o ON o.id = i.originFk
|
||||
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN vn.worker w ON w.id = it.workerFk
|
||||
LEFT JOIN edi.supplier s ON s.supplier_id = e.pro
|
||||
JOIN vn.entry e2 ON e2.id = b.entryFk
|
||||
JOIN vn.travel t ON t.id = e2.travelFk
|
||||
JOIN numbers num
|
||||
WHERE b.id = ?
|
||||
b.itemFk,
|
||||
i.name item,
|
||||
b.id buyFk,
|
||||
b.quantity,
|
||||
b.packing,
|
||||
b.entryFk,
|
||||
o.code origin,
|
||||
p.`name` producerName,
|
||||
p.id producerFk,
|
||||
i.`size`,
|
||||
i.category,
|
||||
i.stems,
|
||||
i.inkFk,
|
||||
ig.longName,
|
||||
ig.subName,
|
||||
i.comment,
|
||||
w.code buyerName
|
||||
FROM vn.buy b
|
||||
JOIN vn.item i ON i.id = b.itemFk
|
||||
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
||||
JOIN vn.origin o ON o.id = i.originFk
|
||||
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN vn.worker w ON w.id = it.workerFk
|
||||
JOIN numbers num
|
||||
WHERE b.id = ?
|
Loading…
Reference in New Issue