Merge pull request 'feat(previaDelta): refs #8030 new algorithym for coincident records' (!3036) from 8030-newPriceComponent into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #3036 Reviewed-by: Pablo Natek <pablone@verdnatura.es>
This commit is contained in:
commit
de93e477f8
|
@ -28,24 +28,29 @@ BEGIN
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tPriceDelta
|
CREATE OR REPLACE TEMPORARY TABLE tPriceDelta
|
||||||
(INDEX (itemFk))
|
(INDEX (itemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT i.id itemFk,
|
SELECT * FROM
|
||||||
SUM(IFNULL(pd.absIncreasing,0)) absIncreasing,
|
(
|
||||||
SUM(IFNULL(pd.ratIncreasing,0)) ratIncreasing,
|
SELECT i.id itemFk,
|
||||||
pd.warehouseFk
|
SUM(IFNULL(pd.absIncreasing,0)) absIncreasing,
|
||||||
FROM item i
|
SUM(IFNULL(pd.ratIncreasing,0)) ratIncreasing,
|
||||||
JOIN priceDelta pd
|
pd.warehouseFk
|
||||||
ON pd.itemTypeFk = i.typeFk
|
FROM item i
|
||||||
AND (pd.minSize IS NULL OR pd.minSize <= i.`size`)
|
JOIN priceDelta pd
|
||||||
AND (pd.maxSize IS NULL OR pd.maxSize >= i.`size`)
|
ON pd.itemTypeFk = i.typeFk
|
||||||
AND (pd.inkFk IS NULL OR pd.inkFk = i.inkFk)
|
AND (pd.minSize IS NULL OR pd.minSize <= i.`size`)
|
||||||
AND (pd.originFk IS NULL OR pd.originFk = i.originFk)
|
AND (pd.maxSize IS NULL OR pd.maxSize >= i.`size`)
|
||||||
AND (pd.producerFk IS NULL OR pd.producerFk = i.producerFk)
|
AND (pd.inkFk IS NULL OR pd.inkFk = i.inkFk)
|
||||||
AND (pd.warehouseFk IS NULL OR pd.warehouseFk = vWarehouseFk)
|
AND (pd.originFk IS NULL OR pd.originFk = i.originFk)
|
||||||
LEFT JOIN zoneGeo zg ON zg.id = pd.zoneGeoFk
|
AND (pd.producerFk IS NULL OR pd.producerFk = i.producerFk)
|
||||||
WHERE (pd.fromDated IS NULL OR pd.fromDated <= vShipped)
|
AND (pd.warehouseFk IS NULL OR pd.warehouseFk = vWarehouseFk)
|
||||||
AND (pd.toDated IS NULL OR pd.toDated >= vShipped)
|
LEFT JOIN zoneGeo zg ON zg.id = pd.zoneGeoFk
|
||||||
AND (pd.zoneGeoFk IS NULL OR address_getGeo(vAddressFk) BETWEEN zg.lft AND zg.rgt)
|
LEFT JOIN zoneGeo zg2 ON zg2.id = address_getGeo(vAddressFk)
|
||||||
GROUP BY i.id;
|
WHERE (pd.fromDated IS NULL OR pd.fromDated <= vShipped)
|
||||||
|
AND (pd.toDated IS NULL OR pd.toDated >= vShipped)
|
||||||
|
AND (pd.zoneGeoFk IS NULL OR zg2.lft BETWEEN zg.lft AND zg.rgt)
|
||||||
|
ORDER BY zg.`depth` DESC
|
||||||
|
LIMIT 10000000000000000000
|
||||||
|
) sub GROUP BY itemFk;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice
|
CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice
|
||||||
(INDEX (itemFk))
|
(INDEX (itemFk))
|
||||||
|
|
Loading…
Reference in New Issue