Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1758316c

Von Bernd Bleßmann vor 4 Monaten hinzugefügt

  • ID 1758316cbea2d674b3fcfce86dc82a224e6d3bcd
  • Vorgänger c5d1e2ed
  • Nachfolger a00ec2d1

Zwischeninventur: Mobil-Menüeintrag und -Controller

Unterschiede anzeigen:

SL/Controller/StockCounting.pm
1
package SL::Controller::StockCounting;
2

  
3
use strict;
4
use parent qw(SL::Controller::Base);
5

  
6
use SL::DB::Employee;
7
use SL::DB::StockCounting;
8
use SL::DB::StockCountingItem;
9

  
10
use SL::Locale::String qw(t8);
11

  
12
use Rose::Object::MakeMethods::Generic(
13
  #scalar => [ qw() ],
14
  'scalar --get_set_init' => [ qw(is_developer countings stock_counting_item) ],
15
);
16

  
17
# check permissions
18
__PACKAGE__->run_before(sub { $::auth->assert('warehouse_management'); });
19

  
20
# load js
21
__PACKAGE__->run_before(sub { $::request->layout->add_javascripts('kivi.Validator.js', 'kivi.StockCounting.js'); });
22

  
23
################ actions #################
24

  
25
sub action_select_counting {
26
  my ($self) = @_;
27

  
28
  $self->render('stock_counting/select_counting');
29
}
30

  
31
sub action_start_counting {
32
  my ($self) = @_;
33

  
34
  $self->render('stock_counting/count');
35
}
36

  
37
sub action_count {
38
  my ($self) = @_;
39

  
40
  my @errors;
41
  push @errors, t8('EAN is missing')    if !$::form->{ean};
42

  
43
  return $self->render('stock_counting/count', errors => \@errors) if @errors;
44

  
45
  my $parts = SL::DB::Manager::Part->get_all(where => [ean => $::form->{ean},
46
                                                       or  => [obsolete => 0, obsolete => undef]]);
47
  push @errors, t8 ('Part not found')    if scalar(@$parts) == 0;
48
  push @errors, t8 ('Part is ambiguous') if scalar(@$parts) >  1;
49

  
50
  $self->stock_counting_item->part($parts->[0]) if !@errors;
51

  
52
  my @validation_errors = $self->stock_counting_item->validate;
53
  push @errors, @validation_errors if @validation_errors;
54

  
55
  $::form->error(join "\n", @errors) if @errors;
56

  
57
  $self->stock_counting_item->qty(1);
58
  $self->stock_counting_item->save;
59

  
60
  $self->render('stock_counting/count',);
61
}
62

  
63
sub init_is_developer {
64
  !!$::auth->assert('developer', 'may_fail')
65
}
66

  
67
sub init_countings {
68
  SL::DB::Manager::StockCounting->get_all_sorted;
69
}
70

  
71
sub init_stock_counting_item {
72
  SL::DB::StockCountingItem->new(%{$::form->{stock_counting_item}},
73
                                 employee => SL::DB::Manager::Employee->current);
74
}
75

  
76
1;
js/kivi.StockCounting.js
1
namespace('kivi.StockCounting', function(ns) {
2

  
3
});
menus/mobile/00-erp.yaml
16 16
  access: ap_transactions
17 17
  params:
18 18
    action: ScanQRBill/scan_view
19
- id: stock_counting
20
  name: Stock Counting
21
  order: 250
22
  access: warehouse_management
23
  params:
24
    action: StockCounting/select_counting
19 25
- id: component_test
20 26
  name: Component Test
21 27
  order: 300
templates/mobile_webpages/stock_counting/count.html
1
[%- USE T8 %]
2
[%- USE LxERP %]
3
[%- USE P %]
4

  
5

  
6
<div class="section">
7
  <div class="container">
8
    <div class="z-depth-1 grey lighten-4 row" style="padding: 32px 48px 0px 48px; border: 1px solid #EEE;">
9
      <div class="row">[% SELF.stock_counting_item.counting.name %]</div>
10
      <div class="row">[% SELF.stock_counting_item.counting.description %]</div>
11
      <div class="row">[% SELF.stock_counting_item.counting.part.displayable_name %]</div>
12
      <div class="row">[% SELF.stock_counting_item.counting.partsgroup.displayable_name %]</div>
13
      <div class="row">[% SELF.stock_counting_item.counting.vendor.displayable_name %]</div>
14
      <form method="post" name="count_form" id="count_form" action="controller.pl" target="_top" class="col s12">
15
        [% P.hidden_tag('stock_counting_item.counting_id', SELF.stock_counting_item.counting_id) %]
16
        [% IF SELF.stock_counting_item.counting.bin_id %]
17
          <div class="row">[% SELF.stock_counting_item.counting.bin.full_description %]</div>
18
          [% P.hidden_tag('stock_counting_item.bin_id', SELF.stock_counting_item.counting.bin_id) %]
19
        [% ELSE %]
20
          <div class="row">
21
            [% P.M.wh_bin_select('dummy_wh', bin_name='stock_counting_item.bin_id', with_empty=1, 'data-validate'='required', label=LxERP.t8('Bin'), class='col s12') %]
22
          </div>
23
        [% END %]
24
        <div class="row">
25
          [% P.M.input_tag('ean', '', placeholder=last_ean || LxERP.t8('EAN'), 'data-validate'='required', label=LxERP.t8('Part to count'), class='col s12') %]
26
        </div>
27
        <div class="row">
28
          [% P.hidden_tag("action", "StockCounting/count") %]
29
          [% P.M.submit_tag("btn_count", LxERP.t8("Do count"), class="col s12", large=1) %]
30
        </div>
31
      </form>
32
    </div>
33
  </div>
34
</div>
templates/mobile_webpages/stock_counting/select_counting.html
1
[%- USE T8 %]
2
[%- USE LxERP %]
3
[%- USE P %]
4

  
5
<div class="section">
6
  <div class="container">
7
    <div class="z-depth-1 grey lighten-4 row" style="padding: 32px 48px 0px 48px; border: 1px solid #EEE;">
8
      <form method="post" name="count_form" action="controller.pl" target="_top" class="col s12">
9
        <div class="row">
10
          [% P.M.select_tag('stock_counting_item.counting_id', SELF.countings,
11
                            class='col s12',
12
                            title_key='name',
13
                            label=LxERP.t8('Select a Stock Counting'))
14
          %]
15
        </div>
16
        <div class="row">
17
          [% P.hidden_tag("action", "StockCounting/start_counting") %]
18
          [% P.M.submit_tag("btn_start", LxERP.t8("Start"), class="col s12", large=1) %]
19
        </div>
20
      </form>
21
    </div>
22
  </div>
23
</div>

Auch abrufbar als: Unified diff