u
This commit is contained in:
@@ -34,6 +34,7 @@ import TuneIcon from '@mui/icons-material/Tune';
|
|||||||
import AutoAwesomeIcon from '@mui/icons-material/AutoAwesome';
|
import AutoAwesomeIcon from '@mui/icons-material/AutoAwesome';
|
||||||
import RequestQuoteIcon from '@mui/icons-material/RequestQuote';
|
import RequestQuoteIcon from '@mui/icons-material/RequestQuote';
|
||||||
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
|
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
|
||||||
|
import AssignmentReturnIcon from '@mui/icons-material/AssignmentReturn';
|
||||||
import BackendError from './BackendError';
|
import BackendError from './BackendError';
|
||||||
import { company } from '../api';
|
import { company } from '../api';
|
||||||
import authAutomat, { bootstrapAuthMe } from '../automats/authAutomat';
|
import authAutomat, { bootstrapAuthMe } from '../automats/authAutomat';
|
||||||
@@ -51,13 +52,15 @@ const NUMBER_SCHEMES = [
|
|||||||
{ type: 'adjustment', label: 'Bestandskorrektur', icon: TuneIcon },
|
{ type: 'adjustment', label: 'Bestandskorrektur', icon: TuneIcon },
|
||||||
{ type: 'quote', label: 'Angebot', icon: RequestQuoteIcon },
|
{ type: 'quote', label: 'Angebot', icon: RequestQuoteIcon },
|
||||||
{ type: 'order', label: 'Bestellung', icon: ShoppingCartIcon },
|
{ type: 'order', label: 'Bestellung', icon: ShoppingCartIcon },
|
||||||
|
{ type: 'return', label: 'Rücksendung (Lieferant)', icon: AssignmentReturnIcon },
|
||||||
|
{ type: 'retoure', label: 'Retoure (Kunde)', icon: AssignmentReturnIcon },
|
||||||
];
|
];
|
||||||
|
|
||||||
const PRESETS = [
|
const PRESETS = [
|
||||||
{
|
{
|
||||||
id: 'standard',
|
id: 'standard',
|
||||||
label: 'Standard',
|
label: 'Standard',
|
||||||
hint: 'Klassische Kürzel (ART-, KD-, LS-, KORR-, ANG-, AUF-)',
|
hint: 'Klassische Kürzel (ART-, KD-, LS-, KORR-, ANG-, AUF-, RTN-, RET-)',
|
||||||
values: {
|
values: {
|
||||||
sku: { prefix: 'ART-', padding: 6, next: 1 },
|
sku: { prefix: 'ART-', padding: 6, next: 1 },
|
||||||
entity: { prefix: 'KD-', padding: 6, next: 1001 },
|
entity: { prefix: 'KD-', padding: 6, next: 1001 },
|
||||||
@@ -65,6 +68,8 @@ const PRESETS = [
|
|||||||
adjustment: { prefix: 'KORR-', padding: 5, next: 1 },
|
adjustment: { prefix: 'KORR-', padding: 5, next: 1 },
|
||||||
quote: { prefix: 'ANG-', padding: 6, next: 1 },
|
quote: { prefix: 'ANG-', padding: 6, next: 1 },
|
||||||
order: { prefix: 'AUF-', padding: 6, next: 1 },
|
order: { prefix: 'AUF-', padding: 6, next: 1 },
|
||||||
|
return: { prefix: 'RTN-', padding: 6, next: 1 },
|
||||||
|
retoure: { prefix: 'RET-', padding: 6, next: 1 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -78,12 +83,14 @@ const PRESETS = [
|
|||||||
adjustment: { prefix: '', padding: 5, next: 90001 },
|
adjustment: { prefix: '', padding: 5, next: 90001 },
|
||||||
quote: { prefix: '', padding: 5, next: 40001 },
|
quote: { prefix: '', padding: 5, next: 40001 },
|
||||||
order: { prefix: '', padding: 5, next: 50001 },
|
order: { prefix: '', padding: 5, next: 50001 },
|
||||||
|
return: { prefix: 'RTN', padding: 5, next: 1 },
|
||||||
|
retoure: { prefix: 'RET', padding: 5, next: 1 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'compact',
|
id: 'compact',
|
||||||
label: 'Kurzkürzel',
|
label: 'Kurzkürzel',
|
||||||
hint: 'Einbuchstabige Präfixe (A-, K-, L-, B-, AG-, AU-)',
|
hint: 'Einbuchstabige Präfixe (A-, K-, L-, B-, AG-, AU-, RTN-, RET-)',
|
||||||
values: {
|
values: {
|
||||||
sku: { prefix: 'A-', padding: 5, next: 1 },
|
sku: { prefix: 'A-', padding: 5, next: 1 },
|
||||||
entity: { prefix: 'K-', padding: 5, next: 1001 },
|
entity: { prefix: 'K-', padding: 5, next: 1001 },
|
||||||
@@ -91,12 +98,14 @@ const PRESETS = [
|
|||||||
adjustment: { prefix: 'B-', padding: 5, next: 1 },
|
adjustment: { prefix: 'B-', padding: 5, next: 1 },
|
||||||
quote: { prefix: 'AG-', padding: 5, next: 1 },
|
quote: { prefix: 'AG-', padding: 5, next: 1 },
|
||||||
order: { prefix: 'AU-', padding: 5, next: 1 },
|
order: { prefix: 'AU-', padding: 5, next: 1 },
|
||||||
|
return: { prefix: 'RTN-', padding: 5, next: 1 },
|
||||||
|
retoure: { prefix: 'RET-', padding: 5, next: 1 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'international',
|
id: 'international',
|
||||||
label: 'International',
|
label: 'International',
|
||||||
hint: 'Englische Kürzel (SKU-, C-, DEL-, ADJ-, Q-, ORD-)',
|
hint: 'Englische Kürzel (SKU-, C-, DEL-, ADJ-, Q-, ORD-, RTN-, RET-)',
|
||||||
values: {
|
values: {
|
||||||
sku: { prefix: 'SKU-', padding: 5, next: 1 },
|
sku: { prefix: 'SKU-', padding: 5, next: 1 },
|
||||||
entity: { prefix: 'C-', padding: 5, next: 1001 },
|
entity: { prefix: 'C-', padding: 5, next: 1001 },
|
||||||
@@ -104,6 +113,8 @@ const PRESETS = [
|
|||||||
adjustment: { prefix: 'ADJ-', padding: 4, next: 1 },
|
adjustment: { prefix: 'ADJ-', padding: 4, next: 1 },
|
||||||
quote: { prefix: 'Q-', padding: 5, next: 1 },
|
quote: { prefix: 'Q-', padding: 5, next: 1 },
|
||||||
order: { prefix: 'ORD-', padding: 5, next: 1 },
|
order: { prefix: 'ORD-', padding: 5, next: 1 },
|
||||||
|
return: { prefix: 'RTN-', padding: 5, next: 1 },
|
||||||
|
retoure: { prefix: 'RET-', padding: 5, next: 1 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -63,8 +63,10 @@ export function getNextDocumentNumber(kind) {
|
|||||||
const prefixStyle = refSeq?.prefix ?? '';
|
const prefixStyle = refSeq?.prefix ?? '';
|
||||||
|
|
||||||
if (kind === 'retoure') {
|
if (kind === 'retoure') {
|
||||||
prefix = 'RET-';
|
prefix = prefixStyle.endsWith('-') || !prefixStyle ? 'RET-' : 'RET';
|
||||||
pad = 5;
|
startNum = 1;
|
||||||
|
} else if (kind === 'return') {
|
||||||
|
prefix = prefixStyle.endsWith('-') || !prefixStyle ? 'RTN-' : 'RTN';
|
||||||
startNum = 1;
|
startNum = 1;
|
||||||
} else if (kind === 'delivery') {
|
} else if (kind === 'delivery') {
|
||||||
prefix = prefixStyle.startsWith('DEL-') ? 'DEL-' : (prefixStyle.startsWith('L-') ? 'L-' : 'LS-');
|
prefix = prefixStyle.startsWith('DEL-') ? 'DEL-' : (prefixStyle.startsWith('L-') ? 'L-' : 'LS-');
|
||||||
@@ -160,7 +162,16 @@ export async function ensureDocumentNumber(kind) {
|
|||||||
const seq = numbers.find((r) => r.type === kind);
|
const seq = numbers.find((r) => r.type === kind);
|
||||||
let prefix = seq?.prefix;
|
let prefix = seq?.prefix;
|
||||||
if (prefix == null) {
|
if (prefix == null) {
|
||||||
prefix = kind === 'quote' ? 'ANG-' : (kind === 'order' ? 'AUF-' : (kind === 'retoure' ? 'RET-' : 'LS-'));
|
prefix =
|
||||||
|
kind === 'quote'
|
||||||
|
? 'ANG-'
|
||||||
|
: kind === 'order'
|
||||||
|
? 'AUF-'
|
||||||
|
: kind === 'retoure'
|
||||||
|
? 'RET-'
|
||||||
|
: kind === 'return'
|
||||||
|
? 'RTN-'
|
||||||
|
: 'LS-';
|
||||||
}
|
}
|
||||||
|
|
||||||
let maxFound = maxKnownNumberByKind.get(kind) ?? 0;
|
let maxFound = maxKnownNumberByKind.get(kind) ?? 0;
|
||||||
@@ -215,7 +226,9 @@ export function getMaxDocumentNumber(kind = 'quote') {
|
|||||||
|
|
||||||
let prefix = '';
|
let prefix = '';
|
||||||
if (kind === 'retoure') {
|
if (kind === 'retoure') {
|
||||||
return `RET-${'9'.repeat(5)}`;
|
prefix = prefixStyle.endsWith('-') || !prefixStyle ? 'RET-' : 'RET';
|
||||||
|
} else if (kind === 'return') {
|
||||||
|
prefix = prefixStyle.endsWith('-') || !prefixStyle ? 'RTN-' : 'RTN';
|
||||||
} else if (kind === 'delivery') {
|
} else if (kind === 'delivery') {
|
||||||
prefix = prefixStyle.startsWith('DEL-') ? 'DEL-' : (prefixStyle.startsWith('L-') ? 'L-' : 'LS-');
|
prefix = prefixStyle.startsWith('DEL-') ? 'DEL-' : (prefixStyle.startsWith('L-') ? 'L-' : 'LS-');
|
||||||
} else if (
|
} else if (
|
||||||
|
|||||||
Reference in New Issue
Block a user