Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -26,7 +26,7 @@ func GetAccounts(ctx context.Context) ([]models.Account, error) {
|
|||||||
;WITH VendorPiyasa AS
|
;WITH VendorPiyasa AS
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
Cari8 = LEFT(P.CurrAccCode, 8),
|
Cari8 = LEFT(REPLACE(P.CurrAccCode, ' ', ''), 8),
|
||||||
VendorAtt01 = MAX(P.VendorAtt01)
|
VendorAtt01 = MAX(P.VendorAtt01)
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
@@ -53,14 +53,14 @@ func GetAccounts(ctx context.Context) ([]models.Account, error) {
|
|||||||
) pvt
|
) pvt
|
||||||
GROUP BY CurrAccTypeCode, CurrAccCode
|
GROUP BY CurrAccTypeCode, CurrAccCode
|
||||||
) P
|
) P
|
||||||
GROUP BY LEFT(P.CurrAccCode, 8)
|
GROUP BY LEFT(REPLACE(P.CurrAccCode, ' ', ''), 8)
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
x.AccountCode,
|
x.AccountCode,
|
||||||
MAX(x.AccountName) AS AccountName
|
MAX(x.AccountName) AS AccountName
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
LEFT(b.CurrAccCode, 8) AS AccountCode,
|
LEFT(REPLACE(b.CurrAccCode, ' ', ''), 8) AS AccountCode,
|
||||||
COALESCE(d.CurrAccDescription, '') AS AccountName
|
COALESCE(d.CurrAccDescription, '') AS AccountName
|
||||||
FROM trCurrAccBook b
|
FROM trCurrAccBook b
|
||||||
LEFT JOIN cdCurrAccDesc d
|
LEFT JOIN cdCurrAccDesc d
|
||||||
@@ -71,7 +71,7 @@ func GetAccounts(ctx context.Context) ([]models.Account, error) {
|
|||||||
ON f2.CurrAccTypeCode = b.CurrAccTypeCode
|
ON f2.CurrAccTypeCode = b.CurrAccTypeCode
|
||||||
AND f2.CurrAccCode = b.CurrAccCode
|
AND f2.CurrAccCode = b.CurrAccCode
|
||||||
LEFT JOIN VendorPiyasa vp
|
LEFT JOIN VendorPiyasa vp
|
||||||
ON vp.Cari8 = LEFT(b.CurrAccCode, 8)
|
ON vp.Cari8 = LEFT(REPLACE(b.CurrAccCode, ' ', ''), 8)
|
||||||
WHERE b.CurrAccTypeCode IN (1,3)
|
WHERE b.CurrAccTypeCode IN (1,3)
|
||||||
AND %s
|
AND %s
|
||||||
) x
|
) x
|
||||||
@@ -110,10 +110,14 @@ func GetAccounts(ctx context.Context) ([]models.Account, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func formatAccountDisplayCode(code string) string {
|
func formatAccountDisplayCode(code string) string {
|
||||||
trimmed := strings.TrimSpace(code)
|
return normalizeAccountCode8(code)
|
||||||
runes := []rune(trimmed)
|
}
|
||||||
if len(runes) <= 3 {
|
|
||||||
return trimmed
|
func normalizeAccountCode8(code string) string {
|
||||||
}
|
trimmed := strings.TrimSpace(strings.ReplaceAll(code, " ", ""))
|
||||||
return strings.TrimSpace(string(runes[:3]) + " " + string(runes[3:]))
|
runes := []rune(trimmed)
|
||||||
|
if len(runes) > 8 {
|
||||||
|
return string(runes[:8])
|
||||||
|
}
|
||||||
|
return trimmed
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +1,242 @@
|
|||||||
package queries
|
package queries
|
||||||
|
|
||||||
// GetProductStockAttributeOptionsQuery:
|
// GetProductStockAttributeOptionsQuery:
|
||||||
// Urun ozellik filtre secenekleri (distinct aciklamalar).
|
// Cascading filtre secenekleri. Kategori + Urun Ana Grubu zorunlu akisina uygundur.
|
||||||
const GetProductStockAttributeOptionsQuery = `
|
const GetProductStockAttributeOptionsQuery = `
|
||||||
WITH PF AS
|
DECLARE @Kategori NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p1)), '');
|
||||||
|
DECLARE @UrunAnaGrubu NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p2)), '');
|
||||||
|
DECLARE @UrunAltGrubu NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p3)), '');
|
||||||
|
DECLARE @Renk NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p4)), '');
|
||||||
|
DECLARE @Renk2 NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p5)), '');
|
||||||
|
DECLARE @UrunIcerigi NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p6)), '');
|
||||||
|
DECLARE @Fit NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p7)), '');
|
||||||
|
DECLARE @Drop NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p8)), '');
|
||||||
|
DECLARE @Beden NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p9)), '');
|
||||||
|
|
||||||
|
DECLARE @AttrBase TABLE
|
||||||
|
(
|
||||||
|
ProductCode NVARCHAR(50) NOT NULL,
|
||||||
|
Kategori NVARCHAR(100) NOT NULL,
|
||||||
|
UrunAnaGrubu NVARCHAR(100) NOT NULL,
|
||||||
|
UrunAltGrubu NVARCHAR(100) NOT NULL,
|
||||||
|
UrunIcerigi NVARCHAR(100) NOT NULL,
|
||||||
|
Fit NVARCHAR(100) NOT NULL,
|
||||||
|
DropVal NVARCHAR(100) NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO @AttrBase (ProductCode, Kategori, UrunAnaGrubu, UrunAltGrubu, UrunIcerigi, Fit, DropVal)
|
||||||
|
SELECT
|
||||||
|
ProductCode,
|
||||||
|
Kategori = LTRIM(RTRIM(ProductAtt44Desc)),
|
||||||
|
UrunAnaGrubu = LTRIM(RTRIM(ProductAtt01Desc)),
|
||||||
|
UrunAltGrubu = LTRIM(RTRIM(ProductAtt02Desc)),
|
||||||
|
UrunIcerigi = LTRIM(RTRIM(ProductAtt41Desc)),
|
||||||
|
Fit = LTRIM(RTRIM(ProductAtt38Desc)),
|
||||||
|
DropVal = LTRIM(RTRIM(ProductAtt11Desc))
|
||||||
|
FROM ProductFilterWithDescription('TR')
|
||||||
|
WHERE LEN(ProductCode) = 13
|
||||||
|
AND (@Kategori IS NULL OR ProductAtt44Desc = @Kategori)
|
||||||
|
AND (@UrunAnaGrubu IS NULL OR ProductAtt01Desc = @UrunAnaGrubu)
|
||||||
|
AND (@UrunAltGrubu IS NULL OR ProductAtt02Desc = @UrunAltGrubu)
|
||||||
|
AND (@UrunIcerigi IS NULL OR ProductAtt41Desc = @UrunIcerigi)
|
||||||
|
AND (@Fit IS NULL OR ProductAtt38Desc = @Fit)
|
||||||
|
AND (@Drop IS NULL OR ProductAtt11Desc = @Drop);
|
||||||
|
|
||||||
|
IF @Kategori IS NULL OR @UrunAnaGrubu IS NULL
|
||||||
|
BEGIN
|
||||||
|
SELECT 'kategori' AS FieldName, X.FieldValue
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT FieldValue = AB.Kategori
|
||||||
|
FROM @AttrBase AB
|
||||||
|
WHERE AB.Kategori <> ''
|
||||||
|
) X
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'urun_ana_grubu', X.FieldValue
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT FieldValue = AB.UrunAnaGrubu
|
||||||
|
FROM @AttrBase AB
|
||||||
|
WHERE AB.UrunAnaGrubu <> ''
|
||||||
|
) X;
|
||||||
|
RETURN;
|
||||||
|
END;
|
||||||
|
|
||||||
|
;WITH INV AS
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
LTRIM(RTRIM(ProductAtt01Desc)) AS ProductAtt01Desc,
|
X.ItemCode,
|
||||||
LTRIM(RTRIM(ProductAtt02Desc)) AS ProductAtt02Desc,
|
X.ColorCode,
|
||||||
LTRIM(RTRIM(ProductAtt10Desc)) AS ProductAtt10Desc,
|
X.ItemDim1Code,
|
||||||
LTRIM(RTRIM(ProductAtt11Desc)) AS ProductAtt11Desc,
|
X.ItemDim2Code,
|
||||||
LTRIM(RTRIM(ProductAtt21Desc)) AS ProductAtt21Desc,
|
SUM(X.PickingQty1) AS PickingQty1,
|
||||||
LTRIM(RTRIM(ProductAtt35Desc)) AS ProductAtt35Desc,
|
SUM(X.ReserveQty1) AS ReserveQty1,
|
||||||
LTRIM(RTRIM(ProductAtt36Desc)) AS ProductAtt36Desc,
|
SUM(X.DispOrderQty1) AS DispOrderQty1,
|
||||||
LTRIM(RTRIM(ProductAtt44Desc)) AS ProductAtt44Desc
|
SUM(X.InventoryQty1) AS InventoryQty1
|
||||||
FROM ProductFilterWithDescription('TR')
|
FROM
|
||||||
WHERE LEN(ProductCode) = 13
|
(
|
||||||
|
SELECT
|
||||||
|
P.ItemCode, P.ColorCode, P.ItemDim1Code, P.ItemDim2Code,
|
||||||
|
P.Qty1 AS PickingQty1, 0 AS ReserveQty1, 0 AS DispOrderQty1, 0 AS InventoryQty1
|
||||||
|
FROM PickingStates P
|
||||||
|
INNER JOIN @AttrBase AB ON AB.ProductCode = P.ItemCode
|
||||||
|
WHERE P.ItemTypeCode = 1
|
||||||
|
AND LEN(P.ItemCode) = 13
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
R.ItemCode, R.ColorCode, R.ItemDim1Code, R.ItemDim2Code,
|
||||||
|
0, R.Qty1, 0, 0
|
||||||
|
FROM ReserveStates R
|
||||||
|
INNER JOIN @AttrBase AB ON AB.ProductCode = R.ItemCode
|
||||||
|
WHERE R.ItemTypeCode = 1
|
||||||
|
AND LEN(R.ItemCode) = 13
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
D.ItemCode, D.ColorCode, D.ItemDim1Code, D.ItemDim2Code,
|
||||||
|
0, 0, D.Qty1, 0
|
||||||
|
FROM DispOrderStates D
|
||||||
|
INNER JOIN @AttrBase AB ON AB.ProductCode = D.ItemCode
|
||||||
|
WHERE D.ItemTypeCode = 1
|
||||||
|
AND LEN(D.ItemCode) = 13
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
T.ItemCode, T.ColorCode, T.ItemDim1Code, T.ItemDim2Code,
|
||||||
|
0, 0, 0, SUM(T.In_Qty1 - T.Out_Qty1)
|
||||||
|
FROM trStock T WITH (NOLOCK)
|
||||||
|
INNER JOIN @AttrBase AB ON AB.ProductCode = T.ItemCode
|
||||||
|
WHERE T.ItemTypeCode = 1
|
||||||
|
AND LEN(T.ItemCode) = 13
|
||||||
|
GROUP BY T.ItemCode, T.ColorCode, T.ItemDim1Code, T.ItemDim2Code
|
||||||
|
) X
|
||||||
|
GROUP BY X.ItemCode, X.ColorCode, X.ItemDim1Code, X.ItemDim2Code
|
||||||
|
),
|
||||||
|
Avail AS
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
I.ItemCode,
|
||||||
|
Renk = LTRIM(RTRIM(I.ColorCode)),
|
||||||
|
RenkAciklama = LTRIM(RTRIM(C.ColorDescription)),
|
||||||
|
Renk2 = LTRIM(RTRIM(I.ItemDim2Code)),
|
||||||
|
Beden = LTRIM(RTRIM(I.ItemDim1Code)),
|
||||||
|
Kullanilabilir = (I.InventoryQty1 - I.PickingQty1 - I.ReserveQty1 - I.DispOrderQty1)
|
||||||
|
FROM INV I
|
||||||
|
LEFT JOIN cdColorDesc C WITH (NOLOCK)
|
||||||
|
ON C.ColorCode = I.ColorCode
|
||||||
|
AND C.LangCode = 'TR'
|
||||||
|
WHERE (I.InventoryQty1 - I.PickingQty1 - I.ReserveQty1 - I.DispOrderQty1) > 0
|
||||||
)
|
)
|
||||||
SELECT 'att01' AS FieldName, ProductAtt01Desc AS FieldValue FROM PF WHERE ProductAtt01Desc <> '' GROUP BY ProductAtt01Desc
|
SELECT 'kategori' AS FieldName, X.FieldValue
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT FieldValue = AB.Kategori
|
||||||
|
FROM @AttrBase AB
|
||||||
|
WHERE AB.Kategori <> ''
|
||||||
|
) X
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'att02', ProductAtt02Desc FROM PF WHERE ProductAtt02Desc <> '' GROUP BY ProductAtt02Desc
|
SELECT 'urun_ana_grubu', X.FieldValue
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT FieldValue = AB.UrunAnaGrubu
|
||||||
|
FROM @AttrBase AB
|
||||||
|
WHERE AB.UrunAnaGrubu <> ''
|
||||||
|
) X
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'att10', ProductAtt10Desc FROM PF WHERE ProductAtt10Desc <> '' GROUP BY ProductAtt10Desc
|
SELECT 'urun_alt_grubu', X.FieldValue
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT FieldValue = AB.UrunAltGrubu
|
||||||
|
FROM @AttrBase AB
|
||||||
|
WHERE AB.UrunAltGrubu <> ''
|
||||||
|
AND (@Kategori IS NULL OR AB.Kategori = @Kategori)
|
||||||
|
AND (@UrunAnaGrubu IS NULL OR AB.UrunAnaGrubu = @UrunAnaGrubu)
|
||||||
|
) X
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'att11', ProductAtt11Desc FROM PF WHERE ProductAtt11Desc <> '' GROUP BY ProductAtt11Desc
|
SELECT 'renk', X.FieldValue
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT FieldValue = CASE WHEN A.RenkAciklama <> '' THEN A.RenkAciklama ELSE A.Renk END
|
||||||
|
FROM Avail A
|
||||||
|
INNER JOIN @AttrBase AB ON AB.ProductCode = A.ItemCode
|
||||||
|
WHERE (CASE WHEN A.RenkAciklama <> '' THEN A.RenkAciklama ELSE A.Renk END) <> ''
|
||||||
|
AND (@Kategori IS NULL OR AB.Kategori = @Kategori)
|
||||||
|
AND (@UrunAnaGrubu IS NULL OR AB.UrunAnaGrubu = @UrunAnaGrubu)
|
||||||
|
AND (@UrunAltGrubu IS NULL OR AB.UrunAltGrubu = @UrunAltGrubu)
|
||||||
|
AND (@UrunIcerigi IS NULL OR AB.UrunIcerigi = @UrunIcerigi)
|
||||||
|
AND (@Fit IS NULL OR AB.Fit = @Fit)
|
||||||
|
AND (@Drop IS NULL OR AB.DropVal = @Drop)
|
||||||
|
AND (@Renk2 IS NULL OR A.Renk2 = @Renk2)
|
||||||
|
AND (@Beden IS NULL OR A.Beden = @Beden)
|
||||||
|
) X
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'att21', ProductAtt21Desc FROM PF WHERE ProductAtt21Desc <> '' GROUP BY ProductAtt21Desc
|
SELECT 'renk2', X.FieldValue
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT FieldValue = A.Renk2
|
||||||
|
FROM Avail A
|
||||||
|
INNER JOIN @AttrBase AB ON AB.ProductCode = A.ItemCode
|
||||||
|
WHERE A.Renk2 <> ''
|
||||||
|
AND (@Kategori IS NULL OR AB.Kategori = @Kategori)
|
||||||
|
AND (@UrunAnaGrubu IS NULL OR AB.UrunAnaGrubu = @UrunAnaGrubu)
|
||||||
|
AND (@UrunAltGrubu IS NULL OR AB.UrunAltGrubu = @UrunAltGrubu)
|
||||||
|
AND (@UrunIcerigi IS NULL OR AB.UrunIcerigi = @UrunIcerigi)
|
||||||
|
AND (@Fit IS NULL OR AB.Fit = @Fit)
|
||||||
|
AND (@Drop IS NULL OR AB.DropVal = @Drop)
|
||||||
|
AND (@Renk IS NULL OR (CASE WHEN A.RenkAciklama <> '' THEN A.RenkAciklama ELSE A.Renk END) = @Renk)
|
||||||
|
AND (@Beden IS NULL OR A.Beden = @Beden)
|
||||||
|
) X
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'att35', ProductAtt35Desc FROM PF WHERE ProductAtt35Desc <> '' GROUP BY ProductAtt35Desc
|
SELECT 'urun_icerigi', X.FieldValue
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT FieldValue = AB.UrunIcerigi
|
||||||
|
FROM @AttrBase AB
|
||||||
|
WHERE AB.UrunIcerigi <> ''
|
||||||
|
AND (@Kategori IS NULL OR AB.Kategori = @Kategori)
|
||||||
|
AND (@UrunAnaGrubu IS NULL OR AB.UrunAnaGrubu = @UrunAnaGrubu)
|
||||||
|
) X
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'att36', ProductAtt36Desc FROM PF WHERE ProductAtt36Desc <> '' GROUP BY ProductAtt36Desc
|
SELECT 'fit', X.FieldValue
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT FieldValue = AB.Fit
|
||||||
|
FROM @AttrBase AB
|
||||||
|
WHERE AB.Fit <> ''
|
||||||
|
AND (@Kategori IS NULL OR AB.Kategori = @Kategori)
|
||||||
|
AND (@UrunAnaGrubu IS NULL OR AB.UrunAnaGrubu = @UrunAnaGrubu)
|
||||||
|
) X
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'att44', ProductAtt44Desc FROM PF WHERE ProductAtt44Desc <> '' GROUP BY ProductAtt44Desc;
|
SELECT 'drop', X.FieldValue
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT FieldValue = AB.DropVal
|
||||||
|
FROM @AttrBase AB
|
||||||
|
WHERE AB.DropVal <> ''
|
||||||
|
AND (@Kategori IS NULL OR AB.Kategori = @Kategori)
|
||||||
|
AND (@UrunAnaGrubu IS NULL OR AB.UrunAnaGrubu = @UrunAnaGrubu)
|
||||||
|
) X
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'beden', X.FieldValue
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT FieldValue = A.Beden
|
||||||
|
FROM Avail A
|
||||||
|
INNER JOIN @AttrBase AB ON AB.ProductCode = A.ItemCode
|
||||||
|
WHERE A.Beden <> ''
|
||||||
|
AND (@Kategori IS NULL OR AB.Kategori = @Kategori)
|
||||||
|
AND (@UrunAnaGrubu IS NULL OR AB.UrunAnaGrubu = @UrunAnaGrubu)
|
||||||
|
AND (@UrunAltGrubu IS NULL OR AB.UrunAltGrubu = @UrunAltGrubu)
|
||||||
|
AND (@UrunIcerigi IS NULL OR AB.UrunIcerigi = @UrunIcerigi)
|
||||||
|
AND (@Fit IS NULL OR AB.Fit = @Fit)
|
||||||
|
AND (@Drop IS NULL OR AB.DropVal = @Drop)
|
||||||
|
AND (@Renk IS NULL OR (CASE WHEN A.RenkAciklama <> '' THEN A.RenkAciklama ELSE A.Renk END) = @Renk)
|
||||||
|
AND (@Renk2 IS NULL OR A.Renk2 = @Renk2)
|
||||||
|
) X;
|
||||||
`
|
`
|
||||||
|
|
||||||
// GetProductStockQueryByAttributes:
|
// GetProductStockQueryByAttributes:
|
||||||
// Urun ozelliklerine gore stok detay sorgusu.
|
// Urun ozelliklerine gore stok detay sorgusu.
|
||||||
const GetProductStockQueryByAttributes = `
|
const GetProductStockQueryByAttributes = `
|
||||||
DECLARE @Att01 NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p1)), '');
|
DECLARE @Kategori NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p1)), '');
|
||||||
DECLARE @Att02 NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p2)), '');
|
DECLARE @UrunAnaGrubu NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p2)), '');
|
||||||
DECLARE @Att10 NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p3)), '');
|
DECLARE @UrunAltGrubu NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p3)), '');
|
||||||
DECLARE @Att11 NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p4)), '');
|
DECLARE @Renk NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p4)), '');
|
||||||
DECLARE @Att21 NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p5)), '');
|
DECLARE @Renk2 NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p5)), '');
|
||||||
DECLARE @Att35 NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p6)), '');
|
DECLARE @UrunIcerigi NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p6)), '');
|
||||||
DECLARE @Att36 NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p7)), '');
|
DECLARE @Fit NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p7)), '');
|
||||||
DECLARE @Att44 NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p8)), '');
|
DECLARE @Drop NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p8)), '');
|
||||||
|
DECLARE @Beden NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p9)), '');
|
||||||
|
|
||||||
;WITH AttrFiltered AS
|
;WITH AttrFiltered AS
|
||||||
(
|
(
|
||||||
@@ -83,14 +275,12 @@ DECLARE @Att44 NVARCHAR(100) = NULLIF(LTRIM(RTRIM(@p8)), '');
|
|||||||
ProductAtt46Desc
|
ProductAtt46Desc
|
||||||
FROM ProductFilterWithDescription('TR')
|
FROM ProductFilterWithDescription('TR')
|
||||||
WHERE LEN(ProductCode) = 13
|
WHERE LEN(ProductCode) = 13
|
||||||
AND (@Att01 IS NULL OR ProductAtt01Desc = @Att01)
|
AND (@Kategori IS NULL OR ProductAtt44Desc = @Kategori)
|
||||||
AND (@Att02 IS NULL OR ProductAtt02Desc = @Att02)
|
AND (@UrunAnaGrubu IS NULL OR ProductAtt01Desc = @UrunAnaGrubu)
|
||||||
AND (@Att10 IS NULL OR ProductAtt10Desc = @Att10)
|
AND (@UrunAltGrubu IS NULL OR ProductAtt02Desc = @UrunAltGrubu)
|
||||||
AND (@Att11 IS NULL OR ProductAtt11Desc = @Att11)
|
AND (@UrunIcerigi IS NULL OR ProductAtt41Desc = @UrunIcerigi)
|
||||||
AND (@Att21 IS NULL OR ProductAtt21Desc = @Att21)
|
AND (@Fit IS NULL OR ProductAtt38Desc = @Fit)
|
||||||
AND (@Att35 IS NULL OR ProductAtt35Desc = @Att35)
|
AND (@Drop IS NULL OR ProductAtt11Desc = @Drop)
|
||||||
AND (@Att36 IS NULL OR ProductAtt36Desc = @Att36)
|
|
||||||
AND (@Att44 IS NULL OR ProductAtt44Desc = @Att44)
|
|
||||||
),
|
),
|
||||||
INV AS
|
INV AS
|
||||||
(
|
(
|
||||||
@@ -157,18 +347,77 @@ INV AS
|
|||||||
GROUP BY
|
GROUP BY
|
||||||
X.CompanyCode, X.OfficeCode, X.StoreTypeCode, X.StoreCode, X.WarehouseCode,
|
X.CompanyCode, X.OfficeCode, X.StoreTypeCode, X.StoreCode, X.WarehouseCode,
|
||||||
X.ItemTypeCode, X.ItemCode, X.ColorCode, X.ItemDim1Code, X.ItemDim2Code, X.ItemDim3Code
|
X.ItemTypeCode, X.ItemCode, X.ColorCode, X.ItemDim1Code, X.ItemDim2Code, X.ItemDim3Code
|
||||||
|
),
|
||||||
|
Avail AS
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
I.CompanyCode,
|
||||||
|
I.OfficeCode,
|
||||||
|
I.StoreTypeCode,
|
||||||
|
I.StoreCode,
|
||||||
|
I.WarehouseCode,
|
||||||
|
I.ItemTypeCode,
|
||||||
|
I.ItemCode,
|
||||||
|
I.ColorCode,
|
||||||
|
I.ItemDim1Code,
|
||||||
|
I.ItemDim2Code,
|
||||||
|
I.ItemDim3Code,
|
||||||
|
Kullanilabilir = ROUND(I.InventoryQty1 - I.PickingQty1 - I.ReserveQty1 - I.DispOrderQty1, U.RoundDigit),
|
||||||
|
RenkAciklama = LTRIM(RTRIM(C.ColorDescription))
|
||||||
|
FROM INV I
|
||||||
|
JOIN cdItem CI WITH (NOLOCK)
|
||||||
|
ON CI.ItemTypeCode = I.ItemTypeCode
|
||||||
|
AND CI.ItemCode = I.ItemCode
|
||||||
|
LEFT JOIN cdUnitOfMeasure U WITH (NOLOCK)
|
||||||
|
ON U.UnitOfMeasureCode = CI.UnitOfMeasureCode1
|
||||||
|
LEFT JOIN cdColorDesc C WITH (NOLOCK)
|
||||||
|
ON C.ColorCode = I.ColorCode
|
||||||
|
AND C.LangCode = 'TR'
|
||||||
|
WHERE I.ItemTypeCode = 1
|
||||||
|
AND LEN(I.ItemCode) = 13
|
||||||
|
AND (I.InventoryQty1 - I.PickingQty1 - I.ReserveQty1 - I.DispOrderQty1) > 0
|
||||||
|
AND CI.IsBlocked = 0
|
||||||
|
AND I.WarehouseCode IN
|
||||||
|
(
|
||||||
|
'1-0-14','1-0-10','1-0-8','1-2-5','1-2-4','1-0-12','100','1-0-28',
|
||||||
|
'1-0-24','1-2-6','1-1-14','1-0-2','1-0-52','1-1-2','1-0-21','1-1-3',
|
||||||
|
'1-0-33','101','1-014','1-0-49','1-0-36'
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Grouped AS
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
A.ItemCode,
|
||||||
|
A.ColorCode,
|
||||||
|
A.ItemDim2Code
|
||||||
|
FROM Avail A
|
||||||
|
INNER JOIN AttrFiltered AF ON AF.ProductCode = A.ItemCode
|
||||||
|
WHERE (@Renk IS NULL OR (CASE WHEN A.RenkAciklama <> '' THEN A.RenkAciklama ELSE A.ColorCode END) = @Renk)
|
||||||
|
AND (@Renk2 IS NULL OR A.ItemDim2Code = @Renk2)
|
||||||
|
AND (
|
||||||
|
@Beden IS NULL
|
||||||
|
OR EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM Avail AB
|
||||||
|
WHERE AB.ItemCode = A.ItemCode
|
||||||
|
AND AB.ColorCode = A.ColorCode
|
||||||
|
AND ISNULL(AB.ItemDim2Code, '') = ISNULL(A.ItemDim2Code, '')
|
||||||
|
AND AB.ItemDim1Code = @Beden
|
||||||
|
)
|
||||||
|
)
|
||||||
|
GROUP BY A.ItemCode, A.ColorCode, A.ItemDim2Code
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
I.WarehouseCode AS Depo_Kodu,
|
A.WarehouseCode AS Depo_Kodu,
|
||||||
W.WarehouseDescription AS Depo_Adi,
|
W.WarehouseDescription AS Depo_Adi,
|
||||||
IT.ItemTypeDescription AS InventoryType,
|
IT.ItemTypeDescription AS InventoryType,
|
||||||
I.ItemCode AS Urun_Kodu,
|
A.ItemCode AS Urun_Kodu,
|
||||||
AF.ProductDescription AS Madde_Aciklamasi,
|
AF.ProductDescription AS Madde_Aciklamasi,
|
||||||
I.ColorCode AS Renk_Kodu,
|
A.ColorCode AS Renk_Kodu,
|
||||||
C.ColorDescription AS Renk_Aciklamasi,
|
A.RenkAciklama AS Renk_Aciklamasi,
|
||||||
I.ItemDim1Code AS Beden,
|
A.ItemDim1Code AS Beden,
|
||||||
I.ItemDim2Code AS Yaka,
|
A.ItemDim2Code AS Yaka,
|
||||||
ROUND(I.InventoryQty1 - I.PickingQty1 - I.ReserveQty1 - I.DispOrderQty1, U.RoundDigit) AS Kullanilabilir_Envanter,
|
A.Kullanilabilir AS Kullanilabilir_Envanter,
|
||||||
AF.ProductAtt01Desc AS URUN_ANA_GRUBU,
|
AF.ProductAtt01Desc AS URUN_ANA_GRUBU,
|
||||||
AF.ProductAtt02Desc AS URUN_ALT_GRUBU,
|
AF.ProductAtt02Desc AS URUN_ALT_GRUBU,
|
||||||
AF.ProductAtt10Desc AS MARKA,
|
AF.ProductAtt10Desc AS MARKA,
|
||||||
@@ -193,47 +442,32 @@ SELECT
|
|||||||
AF.ProductAtt38Desc AS BIRINCI_PARCA_FIT,
|
AF.ProductAtt38Desc AS BIRINCI_PARCA_FIT,
|
||||||
AF.ProductAtt39Desc AS IKINCI_PARCA_FIT,
|
AF.ProductAtt39Desc AS IKINCI_PARCA_FIT,
|
||||||
AF.ProductAtt40Desc AS BOS2,
|
AF.ProductAtt40Desc AS BOS2,
|
||||||
AF.ProductAtt41Desc AS KISA_KAR,
|
AF.ProductAtt41Desc AS URUN_ICERIGI,
|
||||||
AF.ProductAtt42Desc AS SERI_FASON,
|
AF.ProductAtt42Desc AS SERI_FASON,
|
||||||
AF.ProductAtt43Desc AS STOK_GIRIS_YONTEMI,
|
AF.ProductAtt43Desc AS STOK_GIRIS_YONTEMI,
|
||||||
AF.ProductAtt44Desc AS YETISKIN_GARSON,
|
AF.ProductAtt44Desc AS YETISKIN_GARSON,
|
||||||
AF.ProductAtt45Desc AS ASKILI_YAN,
|
AF.ProductAtt45Desc AS ASKILI_YAN,
|
||||||
AF.ProductAtt46Desc AS BOS3,
|
AF.ProductAtt46Desc AS BOS3,
|
||||||
P.Price AS Fiyat
|
P.Price AS Fiyat
|
||||||
FROM INV I
|
FROM Avail A
|
||||||
|
INNER JOIN Grouped G
|
||||||
|
ON G.ItemCode = A.ItemCode
|
||||||
|
AND G.ColorCode = A.ColorCode
|
||||||
|
AND ISNULL(G.ItemDim2Code, '') = ISNULL(A.ItemDim2Code, '')
|
||||||
INNER JOIN AttrFiltered AF
|
INNER JOIN AttrFiltered AF
|
||||||
ON AF.ProductCode = I.ItemCode
|
ON AF.ProductCode = A.ItemCode
|
||||||
JOIN cdItem CI WITH (NOLOCK)
|
|
||||||
ON CI.ItemTypeCode = I.ItemTypeCode
|
|
||||||
AND CI.ItemCode = I.ItemCode
|
|
||||||
LEFT JOIN cdUnitOfMeasure U WITH (NOLOCK)
|
|
||||||
ON U.UnitOfMeasureCode = CI.UnitOfMeasureCode1
|
|
||||||
LEFT JOIN cdWarehouseDesc W WITH (NOLOCK)
|
LEFT JOIN cdWarehouseDesc W WITH (NOLOCK)
|
||||||
ON W.WarehouseCode = I.WarehouseCode
|
ON W.WarehouseCode = A.WarehouseCode
|
||||||
AND W.LangCode = 'TR'
|
AND W.LangCode = 'TR'
|
||||||
LEFT JOIN bsItemTypeDesc IT WITH (NOLOCK)
|
LEFT JOIN bsItemTypeDesc IT WITH (NOLOCK)
|
||||||
ON IT.ItemTypeCode = I.ItemTypeCode
|
ON IT.ItemTypeCode = A.ItemTypeCode
|
||||||
AND IT.LangCode = 'TR'
|
AND IT.LangCode = 'TR'
|
||||||
LEFT JOIN cdColorDesc C WITH (NOLOCK)
|
|
||||||
ON C.ColorCode = I.ColorCode
|
|
||||||
AND C.LangCode = 'TR'
|
|
||||||
OUTER APPLY (
|
OUTER APPLY (
|
||||||
SELECT TOP 1 Price
|
SELECT TOP 1 Price
|
||||||
FROM prItemBasePrice PB WITH (NOLOCK)
|
FROM prItemBasePrice PB WITH (NOLOCK)
|
||||||
WHERE PB.ItemTypeCode = 1
|
WHERE PB.ItemTypeCode = 1
|
||||||
AND PB.ItemCode = I.ItemCode
|
AND PB.ItemCode = A.ItemCode
|
||||||
AND LEN(PB.ItemCode) = 13
|
AND LEN(PB.ItemCode) = 13
|
||||||
ORDER BY PB.PriceDate DESC
|
ORDER BY PB.PriceDate DESC
|
||||||
) P
|
) P;
|
||||||
WHERE
|
|
||||||
I.ItemTypeCode = 1
|
|
||||||
AND LEN(I.ItemCode) = 13
|
|
||||||
AND (I.InventoryQty1 - I.PickingQty1 - I.ReserveQty1 - I.DispOrderQty1) > 0
|
|
||||||
AND CI.IsBlocked = 0
|
|
||||||
AND I.WarehouseCode IN
|
|
||||||
(
|
|
||||||
'1-0-14','1-0-10','1-0-8','1-2-5','1-2-4','1-0-12','100','1-0-28',
|
|
||||||
'1-0-24','1-2-6','1-1-14','1-0-2','1-0-52','1-1-2','1-0-21','1-1-3',
|
|
||||||
'1-0-33','101','1-014','1-0-49','1-0-36'
|
|
||||||
);
|
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -11,13 +11,51 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func readStockAttrFilters(r *http.Request) (kategori, urunAnaGrubu, urunAltGrubu, renk, renk2, urunIcerigi, fit, drop, beden string) {
|
||||||
|
q := r.URL.Query()
|
||||||
|
|
||||||
|
kategori = strings.TrimSpace(firstNonEmpty(q.Get("kategori"), q.Get("att44")))
|
||||||
|
urunAnaGrubu = strings.TrimSpace(firstNonEmpty(q.Get("urun_ana_grubu"), q.Get("att01")))
|
||||||
|
urunAltGrubu = strings.TrimSpace(firstNonEmpty(q.Get("urun_alt_grubu"), q.Get("att02")))
|
||||||
|
renk = strings.TrimSpace(q.Get("renk"))
|
||||||
|
renk2 = strings.TrimSpace(firstNonEmpty(q.Get("renk2"), q.Get("yaka")))
|
||||||
|
urunIcerigi = strings.TrimSpace(firstNonEmpty(q.Get("urun_icerigi"), q.Get("att41")))
|
||||||
|
fit = strings.TrimSpace(firstNonEmpty(q.Get("fit"), q.Get("att38")))
|
||||||
|
drop = strings.TrimSpace(firstNonEmpty(q.Get("drop"), q.Get("att11")))
|
||||||
|
beden = strings.TrimSpace(q.Get("beden"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func firstNonEmpty(vals ...string) string {
|
||||||
|
for _, v := range vals {
|
||||||
|
if strings.TrimSpace(v) != "" {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// GetProductStockAttributeOptionsHandler
|
// GetProductStockAttributeOptionsHandler
|
||||||
// GET /api/product-stock-attribute-options
|
// GET /api/product-stock-attribute-options
|
||||||
func GetProductStockAttributeOptionsHandler(w http.ResponseWriter, _ *http.Request) {
|
func GetProductStockAttributeOptionsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
kategori, urunAnaGrubu, urunAltGrubu, renk, renk2, urunIcerigi, fit, drop, beden := readStockAttrFilters(r)
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
rows, err := db.MssqlDB.QueryContext(ctx, queries.GetProductStockAttributeOptionsQuery)
|
rows, err := db.MssqlDB.QueryContext(
|
||||||
|
ctx,
|
||||||
|
queries.GetProductStockAttributeOptionsQuery,
|
||||||
|
kategori,
|
||||||
|
urunAnaGrubu,
|
||||||
|
urunAltGrubu,
|
||||||
|
renk,
|
||||||
|
renk2,
|
||||||
|
urunIcerigi,
|
||||||
|
fit,
|
||||||
|
drop,
|
||||||
|
beden,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[PRODUCT-STOCK-ATTR-OPTIONS] SQL hatasi: %v", err)
|
log.Printf("[PRODUCT-STOCK-ATTR-OPTIONS] SQL hatasi: %v", err)
|
||||||
http.Error(w, "SQL hatasi: "+err.Error(), http.StatusInternalServerError)
|
http.Error(w, "SQL hatasi: "+err.Error(), http.StatusInternalServerError)
|
||||||
@@ -26,14 +64,15 @@ func GetProductStockAttributeOptionsHandler(w http.ResponseWriter, _ *http.Reque
|
|||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
result := map[string][]string{
|
result := map[string][]string{
|
||||||
"att01": {},
|
"kategori": {},
|
||||||
"att02": {},
|
"urun_ana_grubu": {},
|
||||||
"att10": {},
|
"urun_alt_grubu": {},
|
||||||
"att11": {},
|
"renk": {},
|
||||||
"att21": {},
|
"renk2": {},
|
||||||
"att35": {},
|
"urun_icerigi": {},
|
||||||
"att36": {},
|
"fit": {},
|
||||||
"att44": {},
|
"drop": {},
|
||||||
|
"beden": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
@@ -59,20 +98,12 @@ func GetProductStockAttributeOptionsHandler(w http.ResponseWriter, _ *http.Reque
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetProductStockQueryByAttributesHandler
|
// GetProductStockQueryByAttributesHandler
|
||||||
// GET /api/product-stock-query-by-attributes?att01=...&att02=...
|
// GET /api/product-stock-query-by-attributes
|
||||||
func GetProductStockQueryByAttributesHandler(w http.ResponseWriter, r *http.Request) {
|
func GetProductStockQueryByAttributesHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
att01 := strings.TrimSpace(r.URL.Query().Get("att01"))
|
kategori, urunAnaGrubu, urunAltGrubu, renk, renk2, urunIcerigi, fit, drop, beden := readStockAttrFilters(r)
|
||||||
att02 := strings.TrimSpace(r.URL.Query().Get("att02"))
|
|
||||||
att10 := strings.TrimSpace(r.URL.Query().Get("att10"))
|
|
||||||
att11 := strings.TrimSpace(r.URL.Query().Get("att11"))
|
|
||||||
att21 := strings.TrimSpace(r.URL.Query().Get("att21"))
|
|
||||||
att35 := strings.TrimSpace(r.URL.Query().Get("att35"))
|
|
||||||
att36 := strings.TrimSpace(r.URL.Query().Get("att36"))
|
|
||||||
att44 := strings.TrimSpace(r.URL.Query().Get("att44"))
|
|
||||||
|
|
||||||
hasAny := att01 != "" || att02 != "" || att10 != "" || att11 != "" || att21 != "" || att35 != "" || att36 != "" || att44 != ""
|
if kategori == "" || urunAnaGrubu == "" {
|
||||||
if !hasAny {
|
http.Error(w, "Kategori ve Urun Ana Grubu secimi zorunludur", http.StatusBadRequest)
|
||||||
http.Error(w, "En az bir urun ozelligi secilmelidir", http.StatusBadRequest)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,11 +111,23 @@ func GetProductStockQueryByAttributesHandler(w http.ResponseWriter, r *http.Requ
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
log.Printf(
|
log.Printf(
|
||||||
"[PRODUCT-STOCK-BY-ATTRS] request att01=%q att02=%q att10=%q att11=%q att21=%q att35=%q att36=%q att44=%q",
|
"[PRODUCT-STOCK-BY-ATTRS] request kategori=%q urun_ana_grubu=%q urun_alt_grubu=%q renk=%q renk2=%q urun_icerigi=%q fit=%q drop=%q beden=%q",
|
||||||
att01, att02, att10, att11, att21, att35, att36, att44,
|
kategori, urunAnaGrubu, urunAltGrubu, renk, renk2, urunIcerigi, fit, drop, beden,
|
||||||
)
|
)
|
||||||
|
|
||||||
rows, err := db.MssqlDB.QueryContext(ctx, queries.GetProductStockQueryByAttributes, att01, att02, att10, att11, att21, att35, att36, att44)
|
rows, err := db.MssqlDB.QueryContext(
|
||||||
|
ctx,
|
||||||
|
queries.GetProductStockQueryByAttributes,
|
||||||
|
kategori,
|
||||||
|
urunAnaGrubu,
|
||||||
|
urunAltGrubu,
|
||||||
|
renk,
|
||||||
|
renk2,
|
||||||
|
urunIcerigi,
|
||||||
|
fit,
|
||||||
|
drop,
|
||||||
|
beden,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[PRODUCT-STOCK-BY-ATTRS] SQL hatasi: %v", err)
|
log.Printf("[PRODUCT-STOCK-BY-ATTRS] SQL hatasi: %v", err)
|
||||||
http.Error(w, "SQL hatasi: "+err.Error(), http.StatusInternalServerError)
|
http.Error(w, "SQL hatasi: "+err.Error(), http.StatusInternalServerError)
|
||||||
|
|||||||
125
ui/quasar.config.js.temporary.compiled.1773067361946.mjs
Normal file
125
ui/quasar.config.js.temporary.compiled.1773067361946.mjs
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* THIS FILE IS GENERATED AUTOMATICALLY.
|
||||||
|
* 1. DO NOT edit this file directly as it won't do anything.
|
||||||
|
* 2. EDIT the original quasar.config file INSTEAD.
|
||||||
|
* 3. DO NOT git commit this file. It should be ignored.
|
||||||
|
*
|
||||||
|
* This file is still here because there was an error in
|
||||||
|
* the original quasar.config file and this allows you to
|
||||||
|
* investigate the Node.js stack error.
|
||||||
|
*
|
||||||
|
* After you fix the original file, this file will be
|
||||||
|
* deleted automatically.
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
// quasar.config.js
|
||||||
|
import { defineConfig } from "@quasar/app-webpack/wrappers";
|
||||||
|
var quasar_config_default = defineConfig(() => {
|
||||||
|
const apiBaseUrl = (process.env.VITE_API_BASE_URL || "/api").trim();
|
||||||
|
return {
|
||||||
|
/* =====================================================
|
||||||
|
APP INFO
|
||||||
|
===================================================== */
|
||||||
|
productName: "Baggi BSS",
|
||||||
|
productDescription: "Baggi Tekstil Business Support System",
|
||||||
|
/* =====================================================
|
||||||
|
BOOT FILES
|
||||||
|
===================================================== */
|
||||||
|
boot: ["dayjs"],
|
||||||
|
/* =====================================================
|
||||||
|
GLOBAL CSS
|
||||||
|
===================================================== */
|
||||||
|
css: ["app.css"],
|
||||||
|
/* =====================================================
|
||||||
|
ICONS / FONTS
|
||||||
|
===================================================== */
|
||||||
|
extras: [
|
||||||
|
"roboto-font",
|
||||||
|
"material-icons"
|
||||||
|
],
|
||||||
|
/* =====================================================
|
||||||
|
BUILD (PRODUCTION)
|
||||||
|
===================================================== */
|
||||||
|
build: {
|
||||||
|
vueRouterMode: "hash",
|
||||||
|
env: {
|
||||||
|
VITE_API_BASE_URL: apiBaseUrl
|
||||||
|
},
|
||||||
|
esbuildTarget: {
|
||||||
|
browser: ["es2022", "firefox115", "chrome115", "safari14"],
|
||||||
|
node: "node20"
|
||||||
|
},
|
||||||
|
// Cache & performance
|
||||||
|
gzip: true,
|
||||||
|
preloadChunks: true
|
||||||
|
},
|
||||||
|
/* =====================================================
|
||||||
|
DEV SERVER (LOCAL)
|
||||||
|
===================================================== */
|
||||||
|
devServer: {
|
||||||
|
server: { type: "http" },
|
||||||
|
port: 9e3,
|
||||||
|
open: true,
|
||||||
|
// DEV proxy (CORS'suz)
|
||||||
|
proxy: [
|
||||||
|
{
|
||||||
|
context: ["/api"],
|
||||||
|
target: "http://localhost:8080",
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
/* =====================================================
|
||||||
|
QUASAR FRAMEWORK
|
||||||
|
===================================================== */
|
||||||
|
framework: {
|
||||||
|
config: {
|
||||||
|
notify: {
|
||||||
|
position: "top",
|
||||||
|
timeout: 2500
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lang: "tr",
|
||||||
|
plugins: [
|
||||||
|
"Loading",
|
||||||
|
"Dialog",
|
||||||
|
"Notify"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
animations: [],
|
||||||
|
/* =====================================================
|
||||||
|
SSR / PWA (DISABLED)
|
||||||
|
===================================================== */
|
||||||
|
ssr: {
|
||||||
|
prodPort: 3e3,
|
||||||
|
middlewares: ["render"],
|
||||||
|
pwa: false
|
||||||
|
},
|
||||||
|
pwa: {
|
||||||
|
workboxMode: "GenerateSW"
|
||||||
|
},
|
||||||
|
/* =====================================================
|
||||||
|
MOBILE / DESKTOP
|
||||||
|
===================================================== */
|
||||||
|
capacitor: {
|
||||||
|
hideSplashscreen: true
|
||||||
|
},
|
||||||
|
electron: {
|
||||||
|
preloadScripts: ["electron-preload"],
|
||||||
|
inspectPort: 5858,
|
||||||
|
bundler: "packager",
|
||||||
|
builder: {
|
||||||
|
appId: "baggisowtfaresystem"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
bex: {
|
||||||
|
extraScripts: []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
export {
|
||||||
|
quasar_config_default as default
|
||||||
|
};
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<q-page
|
<q-page
|
||||||
v-if="canReadOrder"
|
v-if="canReadOrder"
|
||||||
class="order-page q-pa-md"
|
class="order-page q-pa-md"
|
||||||
@@ -7,21 +7,23 @@
|
|||||||
<div class="sticky-stack">
|
<div class="sticky-stack">
|
||||||
<div class="filter-bar row q-col-gutter-md q-mb-sm">
|
<div class="filter-bar row q-col-gutter-md q-mb-sm">
|
||||||
<div
|
<div
|
||||||
v-for="def in attrDefs"
|
v-for="def in filterDefs"
|
||||||
:key="def.key"
|
:key="def.key"
|
||||||
class="col-12 col-md-3"
|
class="col-12 col-md-3"
|
||||||
>
|
>
|
||||||
<q-select
|
<q-select
|
||||||
v-model="filters[def.key]"
|
v-model="filters[def.key]"
|
||||||
:options="filteredAttrOptions[def.key] || []"
|
:options="filteredOptionLists[def.key] || []"
|
||||||
:label="def.label"
|
:label="def.label"
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
clearable
|
clearable
|
||||||
use-input
|
use-input
|
||||||
input-debounce="250"
|
input-debounce="250"
|
||||||
:loading="loadingAttributeOptions"
|
:disable="isFilterDisabled(def.key)"
|
||||||
@filter="(val, update) => filterAttributeOptions(def.key, val, update)"
|
:loading="loadingFilterOptions"
|
||||||
|
@update:model-value="onFilterValueChange(def.key)"
|
||||||
|
@filter="(val, update) => filterOptions(def.key, val, update)"
|
||||||
@keyup.enter="fetchStockByAttributes"
|
@keyup.enter="fetchStockByAttributes"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -32,7 +34,7 @@
|
|||||||
icon="search"
|
icon="search"
|
||||||
label="Sorgula"
|
label="Sorgula"
|
||||||
:loading="loadingStock"
|
:loading="loadingStock"
|
||||||
:disable="!hasAnyFilter"
|
:disable="!canQuery"
|
||||||
@click="fetchStockByAttributes"
|
@click="fetchStockByAttributes"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -253,32 +255,34 @@ const { canRead } = usePermission()
|
|||||||
const canReadOrder = canRead('order')
|
const canReadOrder = canRead('order')
|
||||||
const orderStore = useOrderEntryStore()
|
const orderStore = useOrderEntryStore()
|
||||||
|
|
||||||
const attrDefs = [
|
const filterDefs = [
|
||||||
{ key: 'att01', label: 'Urun Ana Grubu' },
|
{ key: 'kategori', label: 'Kategori' },
|
||||||
{ key: 'att02', label: 'Urun Alt Grubu' },
|
{ key: 'urun_ana_grubu', label: 'Urun Ana Grubu' },
|
||||||
{ key: 'att10', label: 'Marka' },
|
{ key: 'urun_alt_grubu', label: 'Urun Alt Grubu' },
|
||||||
{ key: 'att11', label: 'DR' },
|
{ key: 'renk', label: 'Renk' },
|
||||||
{ key: 'att21', label: 'Kalip' },
|
{ key: 'renk2', label: '2.Renk' },
|
||||||
{ key: 'att35', label: 'Sezon Yili' },
|
{ key: 'urun_icerigi', label: 'Urun Icerigi' },
|
||||||
{ key: 'att36', label: 'Mevsim' },
|
{ key: 'fit', label: 'Fit' },
|
||||||
{ key: 'att44', label: 'Yetiskin/Garson' }
|
{ key: 'drop', label: 'Drop' },
|
||||||
|
{ key: 'beden', label: 'Beden' }
|
||||||
]
|
]
|
||||||
|
|
||||||
const loadingAttributeOptions = ref(false)
|
const loadingFilterOptions = ref(false)
|
||||||
const loadingStock = ref(false)
|
const loadingStock = ref(false)
|
||||||
const errorMessage = ref('')
|
const errorMessage = ref('')
|
||||||
const filters = ref({
|
const filters = ref({
|
||||||
att01: '',
|
kategori: '',
|
||||||
att02: '',
|
urun_ana_grubu: '',
|
||||||
att10: '',
|
urun_alt_grubu: '',
|
||||||
att11: '',
|
renk: '',
|
||||||
att21: '',
|
renk2: '',
|
||||||
att35: '',
|
urun_icerigi: '',
|
||||||
att36: '',
|
fit: '',
|
||||||
att44: ''
|
drop: '',
|
||||||
|
beden: ''
|
||||||
})
|
})
|
||||||
const attributeOptions = ref({})
|
const optionLists = ref({})
|
||||||
const filteredAttrOptions = ref({})
|
const filteredOptionLists = ref({})
|
||||||
const rawRows = ref([])
|
const rawRows = ref([])
|
||||||
const productImageCache = ref({})
|
const productImageCache = ref({})
|
||||||
const productImageLoading = ref({})
|
const productImageLoading = ref({})
|
||||||
@@ -294,8 +298,9 @@ const imageListWaitQueue = []
|
|||||||
const activeSchema = ref(storeSchemaByKey.tak)
|
const activeSchema = ref(storeSchemaByKey.tak)
|
||||||
const activeGrpKey = ref('tak')
|
const activeGrpKey = ref('tak')
|
||||||
const openState = ref({})
|
const openState = ref({})
|
||||||
const hasAnyFilter = computed(() =>
|
const canQuery = computed(() =>
|
||||||
attrDefs.some((def) => String(filters.value?.[def.key] || '').trim() !== '')
|
String(filters.value?.kategori || '').trim() !== '' &&
|
||||||
|
String(filters.value?.urun_ana_grubu || '').trim() !== ''
|
||||||
)
|
)
|
||||||
|
|
||||||
const sizeLabels = computed(() => activeSchema.value?.values || [])
|
const sizeLabels = computed(() => activeSchema.value?.values || [])
|
||||||
@@ -401,9 +406,8 @@ function getProductImageUrl(code, color) {
|
|||||||
|
|
||||||
async function onProductImageError(code, color) {
|
async function onProductImageError(code, color) {
|
||||||
const key = buildImageKey(code, color)
|
const key = buildImageKey(code, color)
|
||||||
const current = String(productImageCache.value[key] || '')
|
|
||||||
const fallback = String(productImageFallbackByKey.value[key] || '')
|
const fallback = String(productImageFallbackByKey.value[key] || '')
|
||||||
if (fallback && current !== fallback && !productImageContentLoading.value[key]) {
|
if (fallback && !productImageContentLoading.value[key]) {
|
||||||
productImageContentLoading.value[key] = true
|
productImageContentLoading.value[key] = true
|
||||||
try {
|
try {
|
||||||
const blobRes = await api.get(fallback, {
|
const blobRes = await api.get(fallback, {
|
||||||
@@ -685,33 +689,84 @@ const level1Groups = computed(() => {
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
function filterAttributeOptions(field, val, update) {
|
function normalizeText(v) {
|
||||||
const source = Array.isArray(attributeOptions.value?.[field])
|
return String(v || '').trim()
|
||||||
? attributeOptions.value[field]
|
}
|
||||||
|
|
||||||
|
function buildFilterParams() {
|
||||||
|
const out = {}
|
||||||
|
for (const def of filterDefs) {
|
||||||
|
const val = normalizeText(filters.value?.[def.key])
|
||||||
|
if (val) out[def.key] = val
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
function isFilterDisabled(key) {
|
||||||
|
if (key === 'kategori') return false
|
||||||
|
if (key === 'urun_ana_grubu') {
|
||||||
|
return normalizeText(filters.value.kategori) === ''
|
||||||
|
}
|
||||||
|
return !canQuery.value
|
||||||
|
}
|
||||||
|
|
||||||
|
function onFilterValueChange(changedKey) {
|
||||||
|
if (changedKey === 'kategori') {
|
||||||
|
filters.value.urun_ana_grubu = ''
|
||||||
|
filters.value.urun_alt_grubu = ''
|
||||||
|
filters.value.renk = ''
|
||||||
|
filters.value.renk2 = ''
|
||||||
|
filters.value.urun_icerigi = ''
|
||||||
|
filters.value.fit = ''
|
||||||
|
filters.value.drop = ''
|
||||||
|
filters.value.beden = ''
|
||||||
|
} else if (changedKey === 'urun_ana_grubu') {
|
||||||
|
filters.value.urun_alt_grubu = ''
|
||||||
|
filters.value.renk = ''
|
||||||
|
filters.value.renk2 = ''
|
||||||
|
filters.value.urun_icerigi = ''
|
||||||
|
filters.value.fit = ''
|
||||||
|
filters.value.drop = ''
|
||||||
|
filters.value.beden = ''
|
||||||
|
} else if (changedKey === 'renk') {
|
||||||
|
filters.value.renk2 = ''
|
||||||
|
filters.value.beden = ''
|
||||||
|
} else if (changedKey === 'renk2') {
|
||||||
|
filters.value.beden = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadFilterOptions()
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterOptions(field, val, update) {
|
||||||
|
const source = Array.isArray(optionLists.value?.[field])
|
||||||
|
? optionLists.value[field]
|
||||||
: []
|
: []
|
||||||
if (!val) {
|
if (!val) {
|
||||||
update(() => {
|
update(() => {
|
||||||
filteredAttrOptions.value[field] = [...source]
|
filteredOptionLists.value[field] = [...source]
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const needle = String(val || '').toLocaleLowerCase('tr-TR')
|
const needle = String(val || '').toLocaleLowerCase('tr-TR')
|
||||||
update(() => {
|
update(() => {
|
||||||
filteredAttrOptions.value[field] = source.filter((opt) =>
|
filteredOptionLists.value[field] = source.filter((opt) =>
|
||||||
String(opt || '').toLocaleLowerCase('tr-TR').includes(needle)
|
String(opt || '').toLocaleLowerCase('tr-TR').includes(needle)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadAttributeOptions() {
|
async function loadFilterOptions() {
|
||||||
loadingAttributeOptions.value = true
|
loadingFilterOptions.value = true
|
||||||
try {
|
try {
|
||||||
const res = await api.get('/product-stock-attribute-options')
|
const res = await api.get('/product-stock-attribute-options', {
|
||||||
|
params: buildFilterParams()
|
||||||
|
})
|
||||||
const payload = res?.data && typeof res.data === 'object' ? res.data : {}
|
const payload = res?.data && typeof res.data === 'object' ? res.data : {}
|
||||||
const next = {}
|
const next = {}
|
||||||
const nextFiltered = {}
|
const nextFiltered = {}
|
||||||
|
|
||||||
for (const def of attrDefs) {
|
for (const def of filterDefs) {
|
||||||
const arr = Array.isArray(payload?.[def.key]) ? payload[def.key] : []
|
const arr = Array.isArray(payload?.[def.key]) ? payload[def.key] : []
|
||||||
const list = arr
|
const list = arr
|
||||||
.map((x) => String(x || '').trim())
|
.map((x) => String(x || '').trim())
|
||||||
@@ -719,26 +774,33 @@ async function loadAttributeOptions() {
|
|||||||
.sort((a, b) => a.localeCompare(b, 'tr'))
|
.sort((a, b) => a.localeCompare(b, 'tr'))
|
||||||
next[def.key] = list
|
next[def.key] = list
|
||||||
nextFiltered[def.key] = [...list]
|
nextFiltered[def.key] = [...list]
|
||||||
|
|
||||||
|
const selected = normalizeText(filters.value?.[def.key])
|
||||||
|
if (selected && !list.includes(selected)) {
|
||||||
|
filters.value[def.key] = ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
attributeOptions.value = next
|
optionLists.value = next
|
||||||
filteredAttrOptions.value = nextFiltered
|
filteredOptionLists.value = nextFiltered
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errorMessage.value = 'Urun ozellik secenekleri alinamadi.'
|
errorMessage.value = 'Urun ozellik secenekleri alinamadi.'
|
||||||
console.error('loadAttributeOptions error:', err)
|
console.error('loadFilterOptions error:', err)
|
||||||
} finally {
|
} finally {
|
||||||
loadingAttributeOptions.value = false
|
loadingFilterOptions.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchStockByAttributes() {
|
async function fetchStockByAttributes() {
|
||||||
if (!hasAnyFilter.value) return
|
if (!canQuery.value) {
|
||||||
|
$q.notify({
|
||||||
const params = {}
|
type: 'warning',
|
||||||
for (const def of attrDefs) {
|
position: 'top-right',
|
||||||
const val = String(filters.value?.[def.key] || '').trim()
|
message: 'Kategori ve Urun Ana Grubu secimi zorunludur.'
|
||||||
if (val) params[def.key] = val
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
const params = buildFilterParams()
|
||||||
|
|
||||||
loadingStock.value = true
|
loadingStock.value = true
|
||||||
errorMessage.value = ''
|
errorMessage.value = ''
|
||||||
@@ -803,14 +865,15 @@ function onLevel2Click(productCode, grp2) {
|
|||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
filters.value = {
|
filters.value = {
|
||||||
att01: '',
|
kategori: '',
|
||||||
att02: '',
|
urun_ana_grubu: '',
|
||||||
att10: '',
|
urun_alt_grubu: '',
|
||||||
att11: '',
|
renk: '',
|
||||||
att21: '',
|
renk2: '',
|
||||||
att35: '',
|
urun_icerigi: '',
|
||||||
att36: '',
|
fit: '',
|
||||||
att44: ''
|
drop: '',
|
||||||
|
beden: ''
|
||||||
}
|
}
|
||||||
rawRows.value = []
|
rawRows.value = []
|
||||||
errorMessage.value = ''
|
errorMessage.value = ''
|
||||||
@@ -823,10 +886,11 @@ function resetForm() {
|
|||||||
productImageFallbackByKey.value = {}
|
productImageFallbackByKey.value = {}
|
||||||
productImageContentLoading.value = {}
|
productImageContentLoading.value = {}
|
||||||
productImageListBlockedUntil.value = 0
|
productImageListBlockedUntil.value = 0
|
||||||
|
void loadFilterOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadAttributeOptions()
|
loadFilterOptions()
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<q-page
|
<q-page
|
||||||
v-if="canReadOrder"
|
v-if="canReadOrder"
|
||||||
class="order-page q-pa-md"
|
class="order-page q-pa-md"
|
||||||
@@ -367,9 +367,8 @@ function getProductImageUrl(code, color) {
|
|||||||
|
|
||||||
async function onProductImageError(code, color) {
|
async function onProductImageError(code, color) {
|
||||||
const key = buildImageKey(code, color)
|
const key = buildImageKey(code, color)
|
||||||
const current = String(productImageCache.value[key] || '')
|
|
||||||
const fallback = String(productImageFallbackByKey.value[key] || '')
|
const fallback = String(productImageFallbackByKey.value[key] || '')
|
||||||
if (fallback && current !== fallback && !productImageContentLoading.value[key]) {
|
if (fallback && !productImageContentLoading.value[key]) {
|
||||||
productImageContentLoading.value[key] = true
|
productImageContentLoading.value[key] = true
|
||||||
try {
|
try {
|
||||||
const blobRes = await api.get(fallback, { baseURL: '', responseType: 'blob' })
|
const blobRes = await api.get(fallback, { baseURL: '', responseType: 'blob' })
|
||||||
|
|||||||
@@ -334,8 +334,16 @@ onMounted(async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
/* Tarih aralığı */
|
/* Tarih aralığı */
|
||||||
const dateFrom = ref(dayjs().startOf('year').format('YYYY-MM-DD'))
|
function getDefaultDateRange () {
|
||||||
const dateTo = ref(dayjs().format('YYYY-MM-DD'))
|
return {
|
||||||
|
from: dayjs().startOf('year').format('YYYY-MM-DD'),
|
||||||
|
to: dayjs().format('YYYY-MM-DD')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultDateRange = getDefaultDateRange()
|
||||||
|
const dateFrom = ref(defaultDateRange.from)
|
||||||
|
const dateTo = ref(defaultDateRange.to)
|
||||||
|
|
||||||
function isValidFromDate (date) {
|
function isValidFromDate (date) {
|
||||||
if (!dateTo.value) return true
|
if (!dateTo.value) return true
|
||||||
@@ -486,8 +494,9 @@ function normalizeText (str) {
|
|||||||
/* Reset */
|
/* Reset */
|
||||||
function resetFilters() {
|
function resetFilters() {
|
||||||
selectedCari.value = null
|
selectedCari.value = null
|
||||||
dateFrom.value = ''
|
const range = getDefaultDateRange()
|
||||||
dateTo.value = ''
|
dateFrom.value = range.from
|
||||||
|
dateTo.value = range.to
|
||||||
selectedMonType.value = monetaryTypeOptions[0].value
|
selectedMonType.value = monetaryTypeOptions[0].value
|
||||||
excludeOpening.value = false
|
excludeOpening.value = false
|
||||||
statementheaderStore.headers = []
|
statementheaderStore.headers = []
|
||||||
|
|||||||
Reference in New Issue
Block a user