mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
fix: flag master data product and fix chickin approve
This commit is contained in:
@@ -2,6 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -11,12 +12,6 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const (
|
||||
chickinOutFunctionCode = "CHICKIN_OUT"
|
||||
chickinUsableLane = "USABLE"
|
||||
chickinSourceTable = "project_chickins"
|
||||
)
|
||||
|
||||
func reflowChickinScope(
|
||||
ctx context.Context,
|
||||
fifoStockV2Svc commonSvc.FifoStockV2Service,
|
||||
@@ -62,9 +57,6 @@ func resolveChickinFlagGroupByProductWarehouse(ctx context.Context, tx *gorm.DB,
|
||||
Select("rr.flag_group_code").
|
||||
Joins("JOIN fifo_stock_v2_flag_groups fg ON fg.code = rr.flag_group_code AND fg.is_active = TRUE").
|
||||
Where("rr.is_active = TRUE").
|
||||
Where("rr.lane = ?", chickinUsableLane).
|
||||
Where("rr.function_code = ?", chickinOutFunctionCode).
|
||||
Where("rr.source_table = ?", chickinSourceTable).
|
||||
Where(`
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
@@ -76,10 +68,13 @@ func resolveChickinFlagGroupByProductWarehouse(ctx context.Context, tx *gorm.DB,
|
||||
AND fm.flag_group_code = rr.flag_group_code
|
||||
)
|
||||
`, productWarehouseID, entity.FlagableTypeProduct).
|
||||
Order("rr.id ASC").
|
||||
Order("fg.priority ASC, rr.id ASC").
|
||||
Limit(1).
|
||||
Take(&selected).Error
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return "", nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user