Einleitung
Manchmal macht JTL die Abgleiche nicht dann, wann man sie braucht und so wie man sie braucht. Immer alles global abzugleichen ist zu aufwändig.
Lösung
Custom Workflow
Code
/*
MIT License
Copyright (c) 2025 T4DT GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-- Shopname für die Queue-Prozedur (Beispiel: Shopabgleich, Einzelaktionen pro Shop)
IF NOT EXISTS (SELECT 1 FROM sys.types WHERE name = 'Parameter_spWriteArticleShopQueue_cShopName')
CREATE TYPE CustomWorkflows.Parameter_spWriteArticleShopQueue_cShopName FROM VARCHAR(50);
GO
-- Kompletter Shopabgleich-Flag
IF NOT EXISTS (SELECT 1 FROM sys.types WHERE name = 'Parameter_spWriteArticleShopQueue_bKomplettabgleich')
CREATE TYPE CustomWorkflows.Parameter_spWriteArticleShopQueue_bKomplettabgleich FROM BIT;
GO
-- Preisabgleich-Flag
IF NOT EXISTS (SELECT 1 FROM sys.types WHERE name = 'Parameter_spWriteArticleShopQueue_bPreisabgleich')
CREATE TYPE CustomWorkflows.Parameter_spWriteArticleShopQueue_bPreisabgleich FROM BIT;
GO
-- Bestandabgleich-Flag
IF NOT EXISTS (SELECT 1 FROM sys.types WHERE name = 'Parameter_spWriteArticleShopQueue_bBestandabgleich')
CREATE TYPE CustomWorkflows.Parameter_spWriteArticleShopQueue_bBestandabgleich FROM BIT;
GO
-- Falls die Prozedur schon existiert, droppe sie
IF EXISTS(SELECT 1 FROM sys.procedures WHERE name = 'spWriteArticleShopQueue')
DROP PROCEDURE CustomWorkflows.spWriteArticleShopQueue;
GO
/*
MIT License
Copyright (c) 2025 T4DT GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
CREATE PROCEDURE [CustomWorkflows].spWriteArticleShopQueue
@kArtikel INT,
@cShopName Parameter_spWriteArticleShopQueue_cShopName,
@bKomplettabgleich Parameter_spWriteArticleShopQueue_bKomplettabgleich,
@bPreisabgleich Parameter_spWriteArticleShopQueue_bPreisabgleich,
@bBestandabgleich Parameter_spWriteArticleShopQueue_bBestandabgleich
AS
BEGIN
UPDATE tArtikelShop SET
nAktion = nAktion | IIF(@bKomplettabgleich = 1, 1, 0)
| IIF (@bPreisabgleich = 1, 2, 0)
| IIF (@bBestandabgleich = 1, 4, 0),
cInet = 'Y'
FROM tArtikelShop
JOIN tArtikel ON tArtikelShop.kArtikel = tArtikel.kArtikel
JOIN tShop ON tArtikelShop.kShop = tShop.kShop
WHERE tShop.cName = @cShopName
AND tartikel.kArtikel = @kArtikel
END
GO
EXEC CustomWorkflows._SetActionDisplayName 'spWriteArticleShopQueue', 'Shopabgleich erzwingen';
GO
EXEC CustomWorkflows._SetActionParameterDisplayName 'Parameter_spWriteArticleShopQueue_cShopName', 'Shopname';
EXEC CustomWorkflows._SetActionParameterDisplayName 'Parameter_spWriteArticleShopQueue_bKomplettabgleich', 'Konplettabgleich';
EXEC CustomWorkflows._SetActionParameterDisplayName 'Parameter_spWriteArticleShopQueue_bPreisabgleich', 'Preisabgleich';
EXEC CustomWorkflows._SetActionParameterDisplayName 'Parameter_spWriteArticleShopQueue_bBestandabgleich', 'Bestandsabgleich';
GO
Kommentare
0 Kommentare
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.