Revision 21437d97
Von Bernd Bleßmann vor 3 Monaten hinzugefügt
SL/Controller/StockCounting.pm | ||
---|---|---|
12 | 12 |
use SL::DB::StockCounting; |
13 | 13 |
use SL::DB::StockCountingItem; |
14 | 14 |
|
15 |
use SL::Helper::Flash qw(flash); |
|
15 | 16 |
use SL::Helper::Number qw(_format_total); |
16 | 17 |
use SL::Locale::String qw(t8); |
17 | 18 |
use SL::ReportGenerator; |
... | ... | |
44 | 45 |
sub action_select_counting { |
45 | 46 |
my ($self) = @_; |
46 | 47 |
|
48 |
if (!$::request->is_mobile) { |
|
49 |
$self->setup_select_counting_action_bar; |
|
50 |
} |
|
51 |
|
|
47 | 52 |
$self->render('stock_counting/select_counting'); |
48 | 53 |
} |
49 | 54 |
|
50 | 55 |
sub action_start_counting { |
51 | 56 |
my ($self) = @_; |
52 | 57 |
|
58 |
if (!$::request->is_mobile) { |
|
59 |
$self->setup_count_action_bar; |
|
60 |
} |
|
61 |
|
|
53 | 62 |
$self->render('stock_counting/count'); |
54 | 63 |
} |
55 | 64 |
|
56 | 65 |
sub action_count { |
57 | 66 |
my ($self) = @_; |
58 | 67 |
|
68 |
if (!$::request->is_mobile) { |
|
69 |
$self->setup_count_action_bar; |
|
70 |
} |
|
71 |
|
|
59 | 72 |
my @errors; |
60 | 73 |
push @errors, t8('EAN is missing') if !$::form->{ean}; |
61 | 74 |
|
62 |
return $self->render('stock_counting/count', errors => \@errors) if @errors;
|
|
75 |
return $self->render_count_error(\@errors) if @errors;
|
|
63 | 76 |
|
64 | 77 |
my $parts = SL::DB::Manager::Part->get_all(where => [ean => $::form->{ean}, |
65 | 78 |
or => [obsolete => 0, obsolete => undef]]); |
66 | 79 |
push @errors, t8 ('Part not found') if scalar(@$parts) == 0; |
67 | 80 |
push @errors, t8 ('Part is ambiguous') if scalar(@$parts) > 1; |
68 | 81 |
|
69 |
return $self->render('stock_counting/count', errors => \@errors) if @errors;
|
|
82 |
return $self->render_count_error(\@errors) if @errors;
|
|
70 | 83 |
|
71 | 84 |
$self->stock_counting_item->part($parts->[0]); |
72 | 85 |
|
73 | 86 |
my @validation_errors = $self->stock_counting_item->validate; |
74 | 87 |
push @errors, @validation_errors if @validation_errors; |
75 | 88 |
|
76 |
return $self->render('stock_counting/count', errors => \@errors) if @errors;
|
|
89 |
return $self->render_count_error(\@errors) if @errors;
|
|
77 | 90 |
|
78 | 91 |
$self->stock_counting_item->qty(1); |
79 | 92 |
$self->stock_counting_item->save; |
80 | 93 |
|
81 |
$self->render('stock_counting/count', successfully_counted => 1); |
|
94 |
if ($::request->is_mobile) { |
|
95 |
$self->render('stock_counting/count', successfully_counted => 1); |
|
96 |
} else { |
|
97 |
flash('info', t8('Part successfully counted')); |
|
98 |
$self->render('stock_counting/count'); |
|
99 |
} |
|
82 | 100 |
} |
83 | 101 |
|
84 | 102 |
sub action_list { |
... | ... | |
237 | 255 |
$_->{stocked} = $_->part->get_stock(bin_id => $_->bin_id) for @$objects; |
238 | 256 |
} |
239 | 257 |
|
258 |
sub render_count_error { |
|
259 |
my ($self, $errors) = @_; |
|
260 |
|
|
261 |
if ($::request->is_mobile) { |
|
262 |
$self->render('stock_counting/count', errors => $errors); |
|
263 |
} else { |
|
264 |
flash('error', @{$errors || [] }); |
|
265 |
$self->render('stock_counting/count'); |
|
266 |
} |
|
267 |
} |
|
268 |
|
|
269 |
sub setup_select_counting_action_bar { |
|
270 |
my ($self) = @_; |
|
271 |
|
|
272 |
for my $bar ($::request->layout->get('actionbar')) { |
|
273 |
$bar->add( |
|
274 |
action => [ |
|
275 |
t8('Start Counting'), |
|
276 |
submit => [ '#count_form', { action => 'StockCounting/start_counting' } ], |
|
277 |
accesskey => 'enter', |
|
278 |
], |
|
279 |
); |
|
280 |
} |
|
281 |
} |
|
282 |
|
|
283 |
sub setup_count_action_bar { |
|
284 |
my ($self) = @_; |
|
285 |
for my $bar ($::request->layout->get('actionbar')) { |
|
286 |
$bar->add( |
|
287 |
action => [ |
|
288 |
t8('Do count'), |
|
289 |
checks => [ ['kivi.validate_form', '#count_form'] ], |
|
290 |
submit => [ '#count_form', { action => 'StockCounting/count' } ], |
|
291 |
accesskey => 'enter', |
|
292 |
], |
|
293 |
); |
|
294 |
} |
|
295 |
} |
|
296 |
|
|
240 | 297 |
1; |
SL/Presenter/Warehouse.pm | ||
---|---|---|
35 | 35 |
: $with_empty ? undef |
36 | 36 |
: $all_warehouses->[0]->bins_sorted_naturally; |
37 | 37 |
|
38 |
my $data_validate = delete $attributes{'data-validate'}; |
|
38 | 39 |
my %div_attributes = ( |
39 | 40 |
name => $div_name, |
40 | 41 |
id => $div_id, |
... | ... | |
50 | 51 |
onchange => 'kivi.Warehouse.wh_changed(this);', |
51 | 52 |
'data-bin-dom-name' => $bin_name, |
52 | 53 |
'data-bin-dom-id' => $bin_id, |
54 |
('data-validate' => $data_validate)x!!$data_validate, |
|
53 | 55 |
%attributes |
54 | 56 |
); |
55 | 57 |
|
56 | 58 |
my %bin_attributes = ( |
57 |
name => $bin_name, |
|
58 |
id => $bin_id, |
|
59 |
default => $bin_default, |
|
60 |
title_key => 'description', |
|
59 |
name => $bin_name, |
|
60 |
id => $bin_id, |
|
61 |
default => $bin_default, |
|
62 |
title_key => 'description', |
|
63 |
('data-validate' => $data_validate)x!!$data_validate, |
|
61 | 64 |
%attributes |
62 | 65 |
); |
63 | 66 |
|
menus/user/00-erp.yaml | ||
---|---|---|
590 | 590 |
access: warehouse_management |
591 | 591 |
params: |
592 | 592 |
action: Inventory/stocktaking |
593 |
- parent: warehouse |
|
594 |
id: warehouse_stock_counting |
|
595 |
name: Stock Counting |
|
596 |
order: 470 |
|
597 |
access: warehouse_management |
|
598 |
params: |
|
599 |
action: StockCounting/select_counting |
|
593 | 600 |
- parent: warehouse |
594 | 601 |
id: warehouse_stock_counting_reconciliation |
595 | 602 |
name: Stock Counting Reconciliations |
templates/design40_webpages/stock_counting/count.html | ||
---|---|---|
1 |
[%- USE T8 %] |
|
2 |
[%- USE LxERP %] |
|
3 |
[%- USE P %] |
|
4 |
|
|
5 |
[%- INCLUDE 'common/flash.html' %] |
|
6 |
|
|
7 |
<h1>[% 'Stock Counting' | $T8 %]</h1> |
|
8 |
|
|
9 |
<div class="wrapper"> |
|
10 |
<table class='tbl-horizontal'> |
|
11 |
<tbody> |
|
12 |
<tr> |
|
13 |
<th>[% 'Stock Counting' | $T8 %]</th> |
|
14 |
<td><span class="data">[% SELF.stock_counting_item.counting.name %]</span></td> |
|
15 |
</tr> |
|
16 |
<tr> |
|
17 |
<th>[% 'Description' | $T8 %]</th> |
|
18 |
<td><span class="data">[% SELF.stock_counting_item.counting.description %]</span></td> |
|
19 |
</tr> |
|
20 |
<tr> |
|
21 |
<th>[% 'Part' | $T8 %]</th> |
|
22 |
<td><span class="data">[% SELF.stock_counting_item.counting.part.displayable_name %]</span></td> |
|
23 |
</tr> |
|
24 |
<tr> |
|
25 |
<th>[% 'Partsgroup' | $T8 %]</th> |
|
26 |
<td><span class="data">[% SELF.stock_counting_item.counting.partsgroup.displayable_name %]</span></td> |
|
27 |
</tr> |
|
28 |
<tr> |
|
29 |
<th>[% 'Vendor' | $T8 %]</th> |
|
30 |
<td><span class="data">[% SELF.stock_counting_item.counting.vendor.displayable_name %]</span></td> |
|
31 |
</tr> |
|
32 |
</tbody> |
|
33 |
</table> |
|
34 |
</div> |
|
35 |
|
|
36 |
<div class="wrapper"> |
|
37 |
<form method="post" name="count_form" id="count_form" action="controller.pl"> |
|
38 |
[% P.hidden_tag('stock_counting_item.counting_id', SELF.stock_counting_item.counting_id) %] |
|
39 |
<table class='tbl-horizontal'> |
|
40 |
<tbody> |
|
41 |
<tr> |
|
42 |
<th>[% 'Bin' | $T8 %]</th> |
|
43 |
<td> |
|
44 |
[% IF SELF.stock_counting_item.counting.bin_id %] |
|
45 |
<span class="data">[% SELF.stock_counting_item.counting.bin.full_description %]</span> |
|
46 |
[% P.hidden_tag('stock_counting_item.bin_id', SELF.stock_counting_item.counting.bin_id) %] |
|
47 |
[% ELSE %] |
|
48 |
[% P.warehouse.wh_bin_select('dummy_wh', bin_name='stock_counting_item.bin_id', with_empty=1, 'data-validate'='required') %] |
|
49 |
[% END %] |
|
50 |
</td> |
|
51 |
</tr> |
|
52 |
<tr> |
|
53 |
<th>[% 'EAN' | $T8 %]</th> |
|
54 |
<td>[% P.input_tag('ean', '', placeholder=last_ean || LxERP.t8('EAN'), 'data-validate'='required') %]</td> |
|
55 |
</tr> |
|
56 |
</table> |
|
57 |
</form> |
|
58 |
</div> |
templates/design40_webpages/stock_counting/select_counting.html | ||
---|---|---|
1 |
[%- USE T8 %] |
|
2 |
[%- USE LxERP %] |
|
3 |
[%- USE P %] |
|
4 |
|
|
5 |
<h1>[% 'Select Stock Counting' | $T8 %]</h1> |
|
6 |
|
|
7 |
<div class="wrapper"> |
|
8 |
<form method="post" id="count_form" action="controller.pl"> |
|
9 |
[% P.select_tag('stock_counting_item.counting_id', SELF.countings, title_key='name') %] |
|
10 |
</form> |
|
11 |
</div> |
templates/webpages/stock_counting/count.html | ||
---|---|---|
1 |
[%- USE T8 %] |
|
2 |
[%- USE LxERP %] |
|
3 |
[%- USE P %] |
|
4 |
|
|
5 |
[%- INCLUDE 'common/flash.html' %] |
|
6 |
|
|
7 |
<h1>[% 'Stock Counting' | $T8 %]</h1> |
|
8 |
|
|
9 |
<table> |
|
10 |
<tbody> |
|
11 |
<tr> |
|
12 |
<th align="right">[% 'Stock Counting' | $T8 %]</th> |
|
13 |
<td>[% SELF.stock_counting_item.counting.name %]</td> |
|
14 |
</tr> |
|
15 |
<tr> |
|
16 |
<th align="right">[% 'Description' | $T8 %]</th> |
|
17 |
<td>[% SELF.stock_counting_item.counting.description %]</td> |
|
18 |
</tr> |
|
19 |
<tr> |
|
20 |
<th align="right">[% 'Part' | $T8 %]</th> |
|
21 |
<td>[% SELF.stock_counting_item.counting.part.displayable_name %]</td> |
|
22 |
</tr> |
|
23 |
<tr> |
|
24 |
<th align="right">[% 'Partsgroup' | $T8 %]</th> |
|
25 |
<td>[% SELF.stock_counting_item.counting.partsgroup.displayable_name %]</td> |
|
26 |
</tr> |
|
27 |
<tr> |
|
28 |
<th align="right">[% 'Vendor' | $T8 %]</th> |
|
29 |
<td>[% SELF.stock_counting_item.counting.vendor.displayable_name %]</td> |
|
30 |
</tr> |
|
31 |
</tbody> |
|
32 |
</table> |
|
33 |
|
|
34 |
<form method="post" name="count_form" id="count_form" action="controller.pl"> |
|
35 |
[% P.hidden_tag('stock_counting_item.counting_id', SELF.stock_counting_item.counting_id) %] |
|
36 |
<table> |
|
37 |
<tbody> |
|
38 |
<tr> |
|
39 |
<th align="right">[% 'Bin' | $T8 %]</th> |
|
40 |
<td> |
|
41 |
[% IF SELF.stock_counting_item.counting.bin_id %] |
|
42 |
[% SELF.stock_counting_item.counting.bin.full_description %] |
|
43 |
[% P.hidden_tag('stock_counting_item.bin_id', SELF.stock_counting_item.counting.bin_id) %] |
|
44 |
[% ELSE %] |
|
45 |
[% P.warehouse.wh_bin_select('dummy_wh', bin_name='stock_counting_item.bin_id', with_empty=1, 'data-validate'='required') %] |
|
46 |
[% END %] |
|
47 |
</td> |
|
48 |
</tr> |
|
49 |
<tr> |
|
50 |
<th align="right">[% 'EAN' | $T8 %]</th> |
|
51 |
<td>[% P.input_tag('ean', '', placeholder=last_ean || LxERP.t8('EAN'), 'data-validate'='required') %]</td> |
|
52 |
</tr> |
|
53 |
</table> |
|
54 |
</form> |
templates/webpages/stock_counting/select_counting.html | ||
---|---|---|
1 |
[%- USE T8 %] |
|
2 |
[%- USE LxERP %] |
|
3 |
[%- USE P %] |
|
4 |
|
|
5 |
<h1>[% 'Select Stock Counting' | $T8 %]</h1> |
|
6 |
|
|
7 |
<form method="post" id="count_form" action="controller.pl"> |
|
8 |
[% P.select_tag('stock_counting_item.counting_id', SELF.countings, title_key='name') %] |
|
9 |
</form> |
Auch abrufbar als: Unified diff
Zwischeninventur: Zähl-Maske auch für Nicht-Mobil