Revision 5067d7bd
Von Martin Helmling martin.helmling@octosoft.eu vor mehr als 7 Jahren hinzugefügt
SL/Controller/CsvImport/Part.pm | ||
---|---|---|
23 | 23 |
use Rose::Object::MakeMethods::Generic |
24 | 24 |
( |
25 | 25 |
scalar => [ qw(table makemodel_columns) ], |
26 |
'scalar --get_set_init' => [ qw(bg_by settings parts_by price_factors_by units_by partsgroups_by |
|
26 |
'scalar --get_set_init' => [ qw(bg_by settings parts_by price_factors_by classification_by units_by partsgroups_by
|
|
27 | 27 |
warehouses_by bins_by |
28 | 28 |
translation_columns all_pricegroups) ], |
29 | 29 |
); |
... | ... | |
40 | 40 |
article_number_policy => 'update_prices', |
41 | 41 |
shoparticle_if_missing => '0', |
42 | 42 |
part_type => 'part', |
43 |
parts_classification => 0, |
|
43 | 44 |
default_buchungsgruppe => ($bugru ? $bugru->id : undef), |
44 | 45 |
apply_buchungsgruppe => 'all', |
45 | 46 |
); |
... | ... | |
58 | 59 |
return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_bg } } ) } qw(id description) }; |
59 | 60 |
} |
60 | 61 |
|
62 |
sub init_classification_by { |
|
63 |
my ($self) = @_; |
|
64 |
my $all_classifications = SL::DB::Manager::PartsClassification->get_all; |
|
65 |
$_->abbreviation($::locale->text($_->abbreviation)) for @{ $all_classifications }; |
|
66 |
return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_classifications } } ) } qw(id abbreviation) }; |
|
67 |
} |
|
68 |
|
|
61 | 69 |
sub init_price_factors_by { |
62 | 70 |
my ($self) = @_; |
63 | 71 |
|
... | ... | |
126 | 134 |
|
127 | 135 |
return { map { ( $_ => $self->controller->profile->get($_) ) } qw(apply_buchungsgruppe default_buchungsgruppe article_number_policy |
128 | 136 |
sellprice_places sellprice_adjustment sellprice_adjustment_type |
129 |
shoparticle_if_missing part_type default_unit) }; |
|
137 |
shoparticle_if_missing part_type classification_id default_unit) };
|
|
130 | 138 |
} |
131 | 139 |
|
132 | 140 |
sub init_all_cvar_configs { |
... | ... | |
174 | 182 |
$i++; |
175 | 183 |
} |
176 | 184 |
|
177 |
$self->add_columns(qw(part_type)) if $self->settings->{part_type} eq 'mixed'; |
|
185 |
$self->add_columns(qw(part_type classification_id)) if $self->settings->{part_type} eq 'mixed';
|
|
178 | 186 |
$self->add_columns(qw(buchungsgruppen_id unit)); |
179 | 187 |
$self->add_columns(map { "${_}_id" } grep { exists $self->controller->data->[0]->{raw_data}->{$_} } qw (price_factor payment partsgroup warehouse bin)); |
180 | 188 |
$self->add_columns(qw(shop)) if $self->settings->{shoparticle_if_missing}; |
... | ... | |
413 | 421 |
# $bg ||= SL::DB::Buchungsgruppe->new(inventory_accno_id => 1); # does this case ever occur? |
414 | 422 |
|
415 | 423 |
my $part_type = $self->settings->{part_type}; |
416 |
if ($part_type eq 'mixed') { |
|
424 |
if ($part_type eq 'mixed' && $entry->{raw_data}->{part_type}) {
|
|
417 | 425 |
$part_type = $entry->{raw_data}->{part_type} =~ m/^p/i ? 'part' |
418 | 426 |
: $entry->{raw_data}->{part_type} =~ m/^s/i ? 'service' |
419 | 427 |
: $entry->{raw_data}->{part_type} =~ m/^assem/i ? 'assembly' |
420 | 428 |
: $entry->{raw_data}->{part_type} =~ m/^assor/i ? 'assortment' |
421 |
: undef; |
|
429 |
: $self->settings->{part_type}; |
|
430 |
} |
|
431 |
my $classification_id = $self->settings->{classification_id}; |
|
432 |
|
|
433 |
if ( $entry->{raw_data}->{pclass} && length($entry->{raw_data}->{pclass}) >= 2 ) { |
|
434 |
my $abbr1 = substr($entry->{raw_data}->{pclass},0,1); |
|
435 |
my $abbr2 = substr($entry->{raw_data}->{pclass},1); |
|
436 |
|
|
437 |
if ( $self->classification_by->{abbreviation}->{$abbr2} ) { |
|
438 |
my $tmp_classification_id = $self->classification_by->{abbreviation}->{$abbr2}->id; |
|
439 |
$classification_id = $tmp_classification_id if $tmp_classification_id; |
|
440 |
} |
|
441 |
if ($part_type eq 'mixed') { |
|
442 |
$part_type = $abbr1 eq $::locale->text('Part (typeabbreviation)') ? 'part' |
|
443 |
: $abbr1 eq $::locale->text('Service (typeabbreviation)') ? 'service' |
|
444 |
: $abbr1 eq $::locale->text('Assembly (typeabbreviation)') ? 'assembly' |
|
445 |
: $abbr1 eq $::locale->text('Assortment (typeabbreviation)') ? 'assortment' |
|
446 |
: undef; |
|
447 |
} |
|
422 | 448 |
} |
423 | 449 |
|
424 | 450 |
# when saving income_accno_id or expense_accno_id use ids from the selected |
... | ... | |
443 | 469 |
} |
444 | 470 |
|
445 | 471 |
$entry->{object}->part_type($part_type); |
472 |
$entry->{object}->classification_id( $classification_id ); |
|
446 | 473 |
|
447 | 474 |
return 1; |
448 | 475 |
} |
... | ... | |
699 | 726 |
|
700 | 727 |
$self->add_displayable_columns({ name => 'bin_id', description => $::locale->text('Bin (database ID)') }, |
701 | 728 |
{ name => 'bin', description => $::locale->text('Bin (name)') }, |
702 |
{ name => 'buchungsgruppen_id', description => $::locale->text('Booking group (database ID)') }, |
|
703 |
{ name => 'buchungsgruppe', description => $::locale->text('Booking group (name)') }, |
|
729 |
{ name => 'buchungsgruppen_id', description => $::locale->text('Booking group (database ID)') },
|
|
730 |
{ name => 'buchungsgruppe', description => $::locale->text('Booking group (name)') },
|
|
704 | 731 |
{ name => 'description', description => $::locale->text('Description') }, |
705 | 732 |
{ name => 'drawing', description => $::locale->text('Drawing') }, |
706 | 733 |
{ name => 'ean', description => $::locale->text('EAN') }, |
... | ... | |
721 | 748 |
{ name => 'partnumber', description => $::locale->text('Part Number') }, |
722 | 749 |
{ name => 'partsgroup_id', description => $::locale->text('Partsgroup (database ID)') }, |
723 | 750 |
{ name => 'partsgroup', description => $::locale->text('Partsgroup (name)') }, |
751 |
{ name => 'classification_by', description => $::locale->text('Article classification') . ' [3]' }, |
|
724 | 752 |
{ name => 'payment_id', description => $::locale->text('Payment terms (database ID)') }, |
725 | 753 |
{ name => 'payment', description => $::locale->text('Payment terms (name)') }, |
726 | 754 |
{ name => 'price_factor_id', description => $::locale->text('Price factor (database ID)') }, |
727 | 755 |
{ name => 'price_factor', description => $::locale->text('Price factor (name)') }, |
728 | 756 |
{ name => 'rop', description => $::locale->text('ROP') }, |
729 | 757 |
{ name => 'sellprice', description => $::locale->text('Sellprice') }, |
730 |
{ name => 'shop', description => $::locale->text('Shop article') },
|
|
731 |
{ name => 'type', description => $::locale->text('Article type') . ' [3]' }, |
|
758 |
{ name => 'shop', description => $::locale->text('Shop article') }, |
|
759 |
{ name => 'type', description => $::locale->text('Article type') . ' [3]' },
|
|
732 | 760 |
{ name => 'unit', description => $::locale->text('Unit (if missing or empty default unit will be used)') }, |
733 | 761 |
{ name => 've', description => $::locale->text('Verrechnungseinheit') }, |
734 | 762 |
{ name => 'warehouse_id', description => $::locale->text('Warehouse (database ID)') }, |
735 |
{ name => 'warehouse', description => $::locale->text('Warehouse (name)') }, |
|
763 |
{ name => 'warehouse', description => $::locale->text('Warehouse (name)') },
|
|
736 | 764 |
{ name => 'weight', description => $::locale->text('Weight') }, |
737 | 765 |
); |
738 | 766 |
|
Auch abrufbar als: Unified diff
Artikel-Klassifizierung
Die ursprünglich als "Artikeltyp" bezeichnete Klassifizierung von Artikeln
Sie dient einer weiteren Gliederung um zum Beispiel den Einkauf vom Verkauf zu trennen, etc.
Gekennzeichnet durch eine Beschreibung (z.B. "Einkauf") und ein Kürzel (z.B. "E")
Flexibel änderbar und erweiterbar.
- Neue Datenbanktablle und Rose-Objekte, sowie Controller zum Bearbeiten der Tabelle
- Zwei-Zeichen Abkürzung:
Der Typ des Artikel und die Klassifizierung werden durch zwei Buchstaben dargestellt.
Der erste Buchstabe ist eine Lokalisierung des Typs des Artikel ('P','A','S') ,
deutch 'W', 'E', und 'D' für Ware Erzeugnis oder Dienstleistung, ggf. weitere Typen.
Der zweite Buchstabe ist eine Lokalisierung der Klassifizierungsabkürzung (abbreviation).
Die Abkürzungen sind aus dem Part Presenter abholbar:
- SL::Presenter::Part->type_abbreviation($part_type)
- SL::Presenter::Part->classification_abbreviation($classification_id)
Wenn im ERP-Dokument nach einer Artikelnummer oder Beschreibung gesucht wird,
diese in den Stammdaten vorhanden ist,
aber der Artikeltyp leer oder falsch ist, bzw im Typ for_purchase bzw for_sale nicht gesetzt ist,
wird die Fehlermeldung "Gesuchter Artikel ist nicht für den Einkauf bzw Verkauf" gemeldet
Anpassung des CSV Import,
nun wird alternativ zur 'type'-Spalte die 'pclass'-Spalte mit zwei Buchstaben geparsed und entsprechend
classification_id,assembly sowie inventory_accno_id gesetzt (oder type_id falls neue Implementierung eingebaut).