mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-23 14:55:42 +00:00
cmd: check validate and fix bug risks in commands
This commit is contained in:
@@ -400,8 +400,10 @@ func buildReferencePlan(ctx context.Context, db *gorm.DB) (*referencePlan, error
|
||||
}
|
||||
|
||||
func runPrechecks(ctx context.Context, db *gorm.DB, rows []planRow, refs *referencePlan, opts *options) error {
|
||||
if err := ensureNoBlockedWarehouseRefs(ctx, db, rows, refs.BlockedWarehouseRefs); err != nil {
|
||||
return err
|
||||
if opts.DeleteWrongWarehouses {
|
||||
if err := ensureNoBlockedWarehouseRefs(ctx, db, rows, refs.BlockedWarehouseRefs); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := ensureNoPurchaseItemWarehouseConflicts(ctx, db, rows); err != nil {
|
||||
return err
|
||||
@@ -813,6 +815,9 @@ func reflowAndRecalculateProductWarehouse(
|
||||
if err != nil {
|
||||
return fmt.Errorf("resolve flag group for product_warehouse %d: %w", productWarehouseID, err)
|
||||
}
|
||||
if flagGroupCode == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
if _, err := fifoSvc.Reflow(ctx, commonSvc.FifoStockV2ReflowRequest{
|
||||
FlagGroupCode: flagGroupCode,
|
||||
@@ -862,6 +867,9 @@ func resolveFlagGroupByProductWarehouse(ctx context.Context, tx *gorm.DB, produc
|
||||
Order("rr.id ASC").
|
||||
Limit(1).
|
||||
Take(&selected).Error
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
return "", nil
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user